Make a field mandatory based on state & substate on Asset form?

Rini1
Tera Guru

Hi all,

I am trying to make 'Disposal reason' field mandatory when state is 'Retired' & substate is 'Disposed'. I tried writing an UI policy and client script, unfortunately it dint work not sure why. Attached screenshot for reference. Any guidance would be much appreciated.

As you can see I have written the UI policy and clients script on 'alm_asset' table I even tried on 'alm_hardware' table but no luck.

 

Thanks

Rini

4 REPLIES 4

AshishKM
Kilo Patron
Kilo Patron

Hi @Rini1 ,

Update the if condition.

and close the If loading check with "}"

keep the below code out of loading check condition

 

if(g_form.getValue("substatus") == "disposed" ){
         g_form.setMandatory("disposal_reason",true);
}

 

 

Reply with full script code if its not working for you, also in client script i don't see any check for retired status.

-Thanks,

AshishKM

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Juhi Poddar
Kilo Patron

Hello @Rini1 

Create a Ui policy on table 'alm_hardware'. Refer the screenshot below for more details:

Screenshot1: Configuration setup of UI policy

 

JuhiPoddar_1-1732106779333.png

Screenshot1: Configuration setup of UI action in UI policy

 

JuhiPoddar_3-1732106909932.png

Result:

JuhiPoddar_0-1732107099033.png

 

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"

 

Thank You
Juhi Poddar

 

 

 

pawank2
Tera Expert

Hi Rini 

make ui policy -- choose the condition state is retired and substate is disposed. after saving the from then you can see below ui policy action. In action you can select disposal reason is mandatory true.

Rini1
Tera Guru

We had issues with the substates creation on the hardware table and we raised a Hi ticket and they sorted the issue.

Thank you all!