Skip to main content

I was able to create a client script that updates the non_part_usage.user_def4 with the person’s phy_svc_grp_c based on the person’s place. If there is no person attached to the task, it will clear the user_def4. If there is a person attached, it will update user_def4 with the person’s place phy_svc_grp_c. The issue that I am running into is when I change the person’s place phy_svc_grp_c on the  place screen, it does not update to the new phy_svc_grp_c but blanks it out. 

Custom Code Assignment - On person_id on screen.

Screen Events - 

Client Script

var personID = getControlValue('task','person_id');

if (isNullOrEmptyString(personID)==true)
{
alert('I am true');
var rows = getDataTableRows('non_part_usage');
if(size(rows) > 0)
{
for(var i=0;i<size(rows);++i)
{
var row = rowsri];
setRowControlValue(row, 'non_part_usage', 'user_def4','');
}
saveChanges();
refreshScreen();
}
}
else if (isNullOrEmptyString(placeId) == false)
{
alert('I am false');
var psgc = getDBValues('SP_PHY_SVC_GRP_C',personID);
var rows = getDataTableRows('non_part_usage');
if(size(rows) > 0)
{
for(var i=0;i<size(rows);++i)
{
var row = rowsri];
setRowControlValue(row, 'non_part_usage', 'user_def4',psgc);
}
saveChanges();
refreshScreen();
}

}
refreshScreen();

Hi @qquac 

I am not following.

You are updating the place record - place.phy_svc_grp_c.

What is it you want to get updated? Is it non_part_usage.user_Def4?

Cheers!


Hi @qquac 

I am not following.

You are updating the place record - place.phy_svc_grp_c.

What is it you want to get updated? Is it non_part_usage.user_Def4?

Cheers!

I want to update non_part_usage.user_def4 with the change I made to place.phy_svc_grp_c. 

 


Hi @qquac 

I would recommend using an XML business rule and not a client script.

If you still wish to use a client script you will need to use createUpdateRequest() functionality.

Cheers!


Reply