Question

Client Script for Web Client - Not Updating

  • 16 April 2024
  • 3 replies
  • 23 views

Userlevel 1
Badge +5
  • Sidekick (Customer)
  • 10 replies

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 = rows[i];
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 = rows[i];
setRowControlValue(row, 'non_part_usage', 'user_def4',psgc);
}
saveChanges();
refreshScreen();
}

}
refreshScreen();

3 replies

Userlevel 6
Badge +26

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!

Userlevel 1
Badge +5

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. 

 

Userlevel 6
Badge +26

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