using onload client script to set empty value on ritm field , after that Unable to save value on the field of requested item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2022 02:18 AM
Hello Everyone,
We are facing one issue, that is we have a select box type variable options are yes/no.
Flow is like child ritm will create from parent ritm.
Requirement is like based on condition once child ritm is created that select box type field value will be empty so that user can select a value according to their choice.
We are setting empty value using onload client script but after that unable to set or save the value on that same field.
Any help on this would be highly appreciated.
Thanks,
Sayan Ghosh
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2022 02:36 AM
Hi Sayan,
Your problem here is onLoad client script, actually you are able to set any other value to that field but as soon as you save the record, form refreshes and on load client script set its value to empty again.
I suggest to check if that field is already checked then don't empty it again through client script.
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2022 02:48 AM
Hi Abhijit,
Actually for few condition that field value will be 'No"
for else it will be "empty" so that user will set the value.
so we are using onload client script to achieve this cause its a child ritm .
any idea like how that field can be updated.
one more thing in that client script we used to check data from server so used script include also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2022 03:14 AM
Hi Sayan,
Please find me answer inline below,
Actually for few condition that field value will be 'No" -> if it should be No and user shouldn't be updating it then you can make it read only for these conditions.
for else it will be "empty" so that user will set the value -> you are setting field value to empty by client script but whenever user changes its value to Yes/ No then add some conditions in client script so that it will not set it to empty again once user has already changed its value which should be kept as it is.
You haven't explained the condition details therefore I won't be able to provide exact logic.
Here is one tip for you : If you are trying to make it empty only for new records then you can check if current record is new using g_form.isNewRecord() then perform operation accordingly.
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Regards,
Abhijit
ServiceNow MVP