Check mandatory fields on the form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Everyone,
I have one field on WO form, based on some conditions (conditions are quite critical) it becomes mandatory otherwise is non mandatory.
I have one server side UI Action where I need to check if the field is mandatory or not right now. How can i do that?
In client side, I can use g_form.isMandatory('u_scr_author'). What is equivalent of isMandatory on server side UI action.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you can't check this on server side.
Why not make that UI action client + server both?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
HI @Ankur Bawiskar ,
This is existing UI Action (Ready for Dispatch) on workspace, I need to add if condition in that - if the mandatory fields has No Bill then it should stop the action and do not create WOT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
as @Ankur Bawiskar stated, this is not available server-side at all/ever unless you write it to the server first...but I am assuming that defeats the purpose of your goal.
This is because on the server (the catalog item record), the variable that you are looking at is not mandatory and the detail that makes it mandatory (based on conditions in the client) is only in the client/browser session.
That info is definitely stored in the session and you may be able to access it. That is how the catalog item widgets display visual indicators about what is or isn't mandatory, which is dynamic and responds to user input like the important conditions that you are citing...but I'm not sure how accessible that is.
Have you considered a different approach and that is to just set up the same conditions on the field in question?
[if <condition set that would make "u_scr_author" mandatory>] OR [if <condition set that would make u_field2_example mandatory>] OR [if <condition set that would make "u_field3_also" mandatory>]....OR.....THEN, specific_field_on_WO_form is mandatory.
Also, please be aware that you won't be able to do this for non variable fields...I am assuming you are speaking about variable fields when saying "one field on WO form".
...if you need to make an sc_task/sc_req_item/sc_request form field (table column) "mandatory" based on client session data, you simply can't.
...but you can *simulate it*...by having a variable be mandatory and get the data that WOULD be entered in the "mandatory form field" based on your business logic and then write to that field on submission. You can then set up an appropriate BR/CS or UI Policy on the associated table.