Make entry in related list mandatory

LG2
Mega Expert

Hi,

We have a simple ttue/false field in our change form - u_relate_to_project - default is false

On submit, If this field is true, I need to check to make sure that there is at least one entry in the project>parent related list (which we also display on the change form related lists), if not then the user will get a notice to say they have to complete the project details.

Any suggestions please?

thanks

We are using Dublin Patch 7 and Project Management v3

1 ACCEPTED SOLUTION

Hi LG,



              Here is the code.



Onsubmit script


________________



function onSubmit() {



  var istrue = g_form.getValue('u_relate_to_project');


  if(istrue == 'true')


  {



  var curSysid = g_form.getUniqueValue();



  var ga = new GlideAjax('check_projects_exists');


  ga.addParam('sysparm_name','isProjectExist');


  ga.addParam('sysparm_currentsysid', curSysid);


  ga.getXMLWait();


  var answer = ga.getAnswer();


  if(answer == 'Not Exist')


  {



  alert('Please select one project');


  return false;



  }




  }



}



__________________________________


Includescript



Name : check_projects_exists


Active : true


Client callable : true




Script:




var check_projects_exists = Class.create();


check_projects_exists.prototype = Object.extendsObject(AbstractAjaxProcessor,


{




  isProjectExist: function()


  {


  var answer ='';


  var cursysid = this.getParameter('sysparm_currentsysid');


  gs.log('cursysid :'+cursysid);



  var gr = new GlideRecord('task');


  gr.addQuery('parent', cursysid);


  gr.query();


  if(!gr.next())


  {


  answer = "Not Exist";


  }


  else


  {


  answer = "Exist";


  }


  return answer;



  }


});


View solution in original post

10 REPLIES 10

Hi ,

kindly help me with below case.is there a way to make below related tabs mandatory on demand form.

1. Resource Plans
2. Cost Plans
3. Benefit Plans
4. Stakeholder
5. Requirements
6. Risks
7. Issues

find_real_file.png