- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 04:55 AM
Hi Team,
In the form on Native view have created a button which leads to workspace to the same record. I require the form to be read only in native view but should be editable in workspace view.
Please let me know How can we achieve This.
Thank you.
Solved! Go to Solution.
- 1,234 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 11:32 PM - edited 05-31-2023 11:37 PM
I have used the Below Code and its working fine.
function onLoad() {
//Type appropriate comment here, and begin script below
var url = top.location.href; // getting the URL Link
var pathname = new URL(url).pathname; // getting the Path workspace : now/risk/, Native :now/nav/ui/.
pathname = pathname.split('/');
var ur = pathname[2];// getting if its a workspace or native
if ( ur == 'nav') {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}else{
fields = g_form.getEditableFields();
for ( x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], false);
}
}
}
Regards,
Prajwal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 11:34 PM
@Ankur Bawiskar
I tried passing the View name to info message showing undefined.
regards
Prajwal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 11:32 PM - edited 05-31-2023 11:37 PM
I have used the Below Code and its working fine.
function onLoad() {
//Type appropriate comment here, and begin script below
var url = top.location.href; // getting the URL Link
var pathname = new URL(url).pathname; // getting the Path workspace : now/risk/, Native :now/nav/ui/.
pathname = pathname.split('/');
var ur = pathname[2];// getting if its a workspace or native
if ( ur == 'nav') {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}else{
fields = g_form.getEditableFields();
for ( x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], false);
}
}
}
Regards,
Prajwal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 11:41 PM
Thank you for Your Solution.