- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:12 AM
Database Request Catalog item have a variable "Database Name". User fill all the details and submitted the Database request catalog item.The variable Database Name should be editable in the requested item form until the request is approved. Once the request is approved database name should be read only in both requested item and catalog task form. Is this doable?
Request: REQ00001
Requested Item: RITM00001
State: Pending Approval
Upon Approval
Catalog Task: TASK00001
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:26 AM
Hi Lakshmi,
Some corrections here. We do have request field in both RITM and catalog task which point to Request using which you can get value of Approved column of Request
Sample script here:
This is for onLoad of RITM & Catalog Task both
When you create this catalog client script mark the checkbox of applied to catalog tasks and RITM view
function onLoad() {
var request = g_form.getReference('request', getRequestDetails);
function getRequestDetails(request){
if(request.approval == 'approved'){
g_form.setReadOnly('variables.<databaseVariableName>', true); // give name of database variable here
}
}
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:16 AM
Hi Lakshmi,
On RITM table there is a field which points to Request table.
you can have onLoad catalog client script on RITM table and check the state whether approved or not at Request level.
if yes then editable if not then readonly.
Similarly there is a field on sc_task i.e. Catalog Task table which points to RITM table and within which you will have a field to point to request.
have similar functionality.
you need to do getReference with callback which is recommended approach in the catalog client script and do this.
https://www.servicenowguru.com/scripting/client-scripts-scripting/gform-getreference-callback/
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:26 AM
Hi Lakshmi,
Some corrections here. We do have request field in both RITM and catalog task which point to Request using which you can get value of Approved column of Request
Sample script here:
This is for onLoad of RITM & Catalog Task both
When you create this catalog client script mark the checkbox of applied to catalog tasks and RITM view
function onLoad() {
var request = g_form.getReference('request', getRequestDetails);
function getRequestDetails(request){
if(request.approval == 'approved'){
g_form.setReadOnly('variables.<databaseVariableName>', true); // give name of database variable here
}
}
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:36 AM
Hi Lakshmi,
Just check the previous comment which contains the script. Try that out and let me know.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 10:50 AM
Thanks Ankur. That worked great!