Skip to main content

Hi Experts,

There is a requirement to create a new Row when user clicks on the ‘Restart’ button as below. I tried to achieve this using the below Client script code. 

 

CurrentScheduleType, currentScheduleRule, currentTaskTemplateId, startDate and productID values were taken from different logics and they were working fine. 

But I am currently facing an issue with the product_pm_id. My assumption was this field should populate (as a next sequence) when executing the addRowToFormDataList function. But as you can see, it is not populating any field value for product_pm_id. 

		var newRow = {
product_pm_id: '',
pm_schedule_type: currentScheduleType,
pm_schedule_rule: currentScheduleRule,
task_template_id: currentTaskTemplateID,
coverage_start_dt: startDate,
product_id: productID

};



addRowToFormDataList(dataList, newRow, true);

Any suggestions are highly appreciated.

 

Thanks,

Hasara

Hi @Hasara Gunasiri 

What is dataList? Can you share where you populate that variable?

As far as I understand you need to populate this with the following code

var dataList = getFormDataLists('table_name')'0];

where the table name is the specific table you are trying to add a record to.

Cheers!


Hi @Shneor Cheshin ,

 

Thank you for the reply.

dataList variable is already defined as below. But still getting the same  results.

 

var dataList=getFormDataLists('product_pm')_0];

Thanks,

Hasara

 

 

 

 


Hi @Shneor Cheshin,

 

This is already fixed with the below code.

It seems there is another UI level setting for the product_pm_id field. New product_pm_id generated during the saving after removing this UI level requirement.

		var dataList=getFormDataLists('c_product_pm_alias'))0];

var currentScheduleType = getRowControlValue(selectedRows,'c_product_pm_alias','pm_schedule_type');
var currentScheduleRule = getRowControlValue(selectedRows,'c_product_pm_alias','pm_schedule_rule');



var newRow = {
pm_schedule_type: currentScheduleType,
pm_schedule_rule: currentScheduleRule,
product_id: productID,

};


addRowToFormDataList(dataList, newRow, true);

 

Thanks for the support.

 

Regards,

Hasara


Reply