SetValue on a onSubmit Catalog Client Script on Service Portal

AdriaM
Mega Sage

Hi all,

Our users maintain certain CIs by Catalog Items. In my case, when they ask for CI modification, we load all updateble CI data on variables, user updates some of this data and, after approval, the CI data is updated automatically by a script.

Certain CIs have a lot of updatable data and approver only wants to review the data that has been updated. To achive this We store, in a hidden variable, the original loaded data of the CI and, onSubmit, we compare it with the submitted data and populate the changes in a changes variable with the g_form.setValue instruction.

This method works in UI but it doesn't work in SP. Is there any way to inform a varible value in a onSubmit Catalog Client Script in SP?

1 ACCEPTED SOLUTION

AdriaM
Mega Sage

The problem is the getMessage call.

It's an asynchronous call so script ends before receiving the message so field is submitted without being updated.

It's necessary to preload the message in order to avoid an asynchronous call on Submit.

View solution in original post

9 REPLIES 9

Voona Rohila
Kilo Patron
Kilo Patron

Make your client script UI Type to 'all'


find_real_file.png


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Prasad Pagar
Mega Sage

Hi,

Did you already tried what Rohila has mentioned?

Thank you
Prasad

AdriaM
Mega Sage

My Script is already marked as all.

Can you share your script 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP