2.3.difference behaviour b/w platform and in portal

nameisnani
Mega Sage

Hi Team , 

 

 

There is a difference behavior between Portal and Platform ends. 

 

We have catalog called Lost or Stolen Device. Based on device type, a Short description is populating .

 

For example, if I choose device type is 'Laptop' >> In short description field, it is populating like this, i.e. [ Lost/Stolen Laptop Report] [By requestor for name 

 

For this, i have written client script.

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

    var deviceTypeValue = g_form.getValue('device_type');

    g_form.getReference('requested_for', function(requestedForRecord) {
        var requestedForValue = requestedForRecord.name;

        g_form.setValue('short_description_1', "Lost/Stolen " + deviceTypeValue + ' ' + " Reported By " + requestedForValue);
    });
}

 

 

 

Now , the problem I am facing is that this is working fine in portal, but when we are checking from the platform , it is not working .

 

If you could see in the below screenshot ,from the portal and platform  in the short description field, Device Type backend name is showing instead of label .

 

Portal View 

nameisnani_0-1724215207075.png

 

 

 

 

Platform view 

nameisnani_1-1724215207075.png

 

 

 

The Result should come like this 

nameisnani_2-1724215207071.png

 

 In both Platform and in portal .

 

@Ravi Gaurav 

 

can anyone please help me here , what changes should i need to do in my script .

5 REPLIES 5

HrishabhKumar
Kilo Sage

Hi @nameisnani 

If none of the previously provided approach worked then please try the following logic.

1) Try defining a variable 'deviceValue' and set it's value according to the backend value of device_type field, and then use this variable in the short description.

 

 

var deviceValue = 'no device';
var backVal = g_form.getValue('device_type');
// use if else condition to set the value of deviceValue variable
if(backVal == 'mobile_device'){
   deviceValue = 'Mobile device';
}
else if(backVal == 'laptop'){
  deviceValue = 'Laptop';
}
// similarly do it for all the choices
// use the variable 'deviceValue' in the short description

 

 

 

2) Otherwise, you can change the backend values to be same as your display value. 

i.e.. display choice value = Mobile Device, and it's backend value = Mobile Device

this will also solve your problem.

 

Thanks

Hope this helps.

Mark it helpful and accept solution if it helps.