Making variable editor editable based on state to opened by user

Hafsa1
Mega Sage

I want variable editor editable for CSM module in portal by "opened by" user in "draft" state.

When I create case via RP , after submit, it create case in "draft" state.

I want every variables to be shown and editable in portal for user. currently only comments is visible

Hafsa1_0-1734494518285.png

 

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

@Hafsa1 

that's the OOB behavior. End users who submit request are not allowed to edit the variables post submission

what's your business requirement?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Runjay Patel
Giga Sage

Hi @Hafsa1 ,

You need to modify the main widget and add then "sp-variable-editor" widget in it. put condition like state is draft then execute else execute the OOB one.

 

Once you add sp-variable-editor your all fields will become editable.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

 

Hafsa1
Mega Sage

we have created a state "draft" in case table. And had a flow for approve, reject and more info required.

Agent can update the case with "more info required" button which will update case to "draft" state and in this state we want all variables to be editable in portal.

 

I have added widget "sp-variable-editor" in the portal page and can see all variables now. But that is in editable format. I want editable only in "draft" state.

Hi @Hafsa1 ,

 

As i said you have to put logic to make it editable only if state is Draft.

Try below.

<sp-variable-editor readonly="{{isReadOnly}}"></sp-variable-editor>

In client script

$scope.isReadOnly = ($scope.data.state !== 'draft'); // Editable only if in "draft"

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------