catalog descp

nameisnani
Mega Sage

Hi Team , 

 

We are having a use case like below 

 

This is the catalog 

nameisnani_0-1718345155552.png

 

nameisnani_1-1718345240245.png

 

 

In the  Short description field auto update has to be show 

 

Auto update the <Short Description> with the following:

"Lost/Stolen" <Device Type> "Reported By" <Requested For>

 

can any one please help me with the confriguration how to achieve this 

 

thanks

8 REPLIES 8

Aleks5
Tera Contributor

Your script should work.

But this only works, if the user fills out the requested for field first.

A onSubmit script would be safer in this case. (Or two onChange scripts?)

Try this one, you might want to change UI Type and check Isolate script:

ZackHilacan1_0-1718350432676.png

Regards.

If the first one does not work because of the your reference field 'requested_for' you may try this :

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }


   var reportedBy = g_form.getDisplayBox('requested_for').value;
    var device =  g_form.getDisplayValue('device_type');
   g_form.setValue('short_description', '"Lost/Stolen " '+ device + ' "Reported by " '+ reportedBy);

   //Type appropriate comment here, and begin script below
   
}

 

Community Alums
Not applicable

Hi @nameisnani ,

I tried your problem in my PDI and it works for me.

Please create onChange client script on any of variable either Device Type or Requestor.

Suppose you create on device type and add below code 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var requestor = g_form.getDisplayValue('requested_for');
    var deviceType = g_form.getDisplayValue('device_type');
    g_form.setValue('short_description', "Lost/Stolen " + deviceType + ' ' + "Reported By " + requestor);
}

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak