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();