TPRMT Respected Contributor.
Respected Contributor.
288 views

Set Field Read only using Ruleset on Phase level

Jump to solution

Hi all,

I have been searching in and around how to set a Field in Request Module as Read Only, during Logging and authorization phase. 

what i did so far,

 

Tried to create a ruleset and using Set a filed using javascript->chosen my field.

This script should set the variable "value" to the desired value for the field.

In the text box, gave the following conditions,
1. readOnly=true;
2. Set(myfield)=true; etc.
 
But nothing works. Can someone help me how to do this if i am doing wrongly.
 
Any quick help is much appreciated.
 
Thanks.
USSKT.
0 Likes
1 Solution

Accepted Solutions
Super Contributor.. bogart Super Contributor..
Super Contributor..

Re: Set Field Read only using Ruleset on Phase level

Jump to solution

Hi USSKT,

condition expressions in forms are not javascript expressions or rad expressions (don't ask why!).

Try this:

[current.phase]="Logging"|[current.phase]="Authorization"

Good luck!

Bo

7 Replies
Super Contributor.. bogart Super Contributor..
Super Contributor..

Re: Set Field Read only using Ruleset on Phase level

Jump to solution

Hi USSKT,

as far as I understand you want a special field on the form set readonly, not the value of the field. Is it right, isn't it?

If so you can use a workflow based rule set on the Initialization tab for setting a variable in a javascript rule. Let's say:

if (record["current.phase"]=="Logging" || record["current.phase"]=="Authorization") {
    vars["$rm.field.xxx.readonly"] = true;
} else {
    vars["$rm.field.xxx.readonly"] = false;
}

After hat you have to find the corresponding forms. open the forms in Forms Designer and set the ReadOnly Condition on the choosen text field:

[$rm.field.xxx.readonly]=true

Give it a try!

Bo

TPRMT Respected Contributor.
Respected Contributor.

Re: Set Field Read only using Ruleset on Phase level

Jump to solution

Hello bogart,

Thanks for your time.

I have tried your steps. 

1. Created new ruleset and used the javascript you gave. 

2. Added this ruleset in Workflow->Request management->Edit Workflow Properties-> Workflow based rulesets->Added under initialization tab.

3. Edited the form in form designer for the field. Checked the Readonly checkbox. Under the Readonly condition updated with"[$rm.field.assigned.group.readonly]=true". I am making Assignment group readonly.

Saved changes and restarted. 

After restart,

1. Tried to create new request. Assignment group was readonly with default group from my profile.

2. filled details and saved the form. Ticket created. Now the assignment group filed becomes empty somehow(still readonly). When i tried to move to next phase(authorization), it throws error saying please provide assignment group, which i cant provide as the field is readonly. What to do in this case?

Thanks for you help so far.

0 Likes
Highlighted
Super Contributor.. bogart Super Contributor..
Super Contributor..

Re: Set Field Read only using Ruleset on Phase level

Jump to solution

Thanks for your reply!

Obviously you have a validation rule for required fields. That's why you can't save and go to the next phase.

But the question is: why is the assignment field empty? This is strange. As long as the field is readonly there must be a rule/fc calculation/trigger which empties the field in background...

It's difficult to say because I don't know your workflow.

Bo 😕

 

 

 

TPRMT Respected Contributor.
Respected Contributor.

Re: Set Field Read only using Ruleset on Phase level

Jump to solution

Hey Bohat,

Thanks, Yes my workflow is different thats why it didnt support. However, i tried a different approach. 

 

-> Opened the form and in field properties, I made READ ONLY checked. And in condition, i put the following,

[current.phase]="Logging" || [current.phase]="Authorization"

This works only for authorization. In Logging phase the field is not read only. Editable. Any guess why or if anything wrong in my statement. please let me know.

Thanks,

USSKT.

0 Likes
Super Contributor.. bogart Super Contributor..
Super Contributor..

Re: Set Field Read only using Ruleset on Phase level

Jump to solution

Hi USSKT,

condition expressions in forms are not javascript expressions or rad expressions (don't ask why!).

Try this:

[current.phase]="Logging"|[current.phase]="Authorization"

Good luck!

Bo

TPRMT Respected Contributor.
Respected Contributor.

Re: Set Field Read only using Ruleset on Phase level

Jump to solution

Hi Bohat,

Thanks alot. It did work like a rocket. You deserve appreciation. Once again thank you for the time and help.

0 Likes
Super Contributor.. bogart Super Contributor..
Super Contributor..

Re: Set Field Read only using Ruleset on Phase level

Jump to solution

You're welcome! 🙂

Thanks,

Bo

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.