how to restrict by creating new project task on the project forn when the state filed value changes to published or retired ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 12:15 AM
Hi All,
I have requirement that , how to restrict by creating new project task on the project forn when the state filed value changes to published or retired ?, we have new state filed on the form , if the value changes to "published or retired" then in , project task under related list, need to restrict creating new tasks?
Please help to achieve
Thanks
Hemachandra
- Labels:
-
Project Portfolio Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 12:25 AM
Hi,
Write a Create operation table level ACL on Project Task table and then configure it as shown below:
So you can give your Field condition above and restrict it say give Roles as Admins in ACL above.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 12:35 AM
Hi Shloke ,
Thanks for the response
ya basically ,we don't want to restrict all the times, only when we creating project in my custom view then only we have to restrict creation of project task, if the project is created in defalut view , so then no need to restrict and the the state field is on the project table and project task is different table
Thanks
Hemachandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 04:58 AM
Hi,
There can be other ways to handle this, what I can think of and works for me is listed below:
1) please create a new hidden field on your Project Table say name it as "View". This is required to capture the view which is getting loaded on Parent Project form and is needed to validate the child Related List.
2) Now once this field is created, create a UI Policy and hide this field so that it is not visible to users.
3) Now Please write a Display Business Rule and use the script below to capture the View name:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var view_name = '';
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
view_name = map.get('sysparm_view').toString();
g_scratchpad.VIEWNAME = view_name;
}
}
})(current, previous);
Now write an On Load Client Script on Project table i.e. View Name and use the script below to set your View Name:
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setValue('u_view_name', g_scratchpad.VIEWNAME);
}
Now once this is done, Right click on the header of Project Task Related List and then select Configure--> List Control as shown below:
Now use the script below in the field "Omit New Condition" as shown below. If this field is not present then add it to the Form layout and then use the same script as shared below:
if(parent.u_view_name == 'planning_console'){ // Replace "planning_console" with your custom View Name
answer = true;
}else{
answer = false;
}
Output:
This works for me in my PDI.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 05:08 AM
Hi Sholke,
Thanks for the code,
ya based on the view, its fine, but i have one more condition that , on the project form i have a custom filed that project state, when ever that filed moved to published then i don't want that new button for project task?, so when should i add that condition in the script?
Thanks
Hemachandra