Clarity

 View Only
Expand all | Collapse all

How to run parametrized Job through a process?

  • 1.  How to run parametrized Job through a process?

    Posted 16 days ago
    Hi,

    I have a requirement where we need to run 'Update Cost Totals' job from a process where I should pass dynamic Project values in it.

    I found something in communities but that is not picking dynamic Project Id.

    Please help!!

    Thanks,
    Jeevana.


  • 2.  RE: How to run parametrized Job through a process?

    Posted 15 days ago
    Can you post the code so we can see what might be going wrong?

    Paul


  • 3.  RE: How to run parametrized Job through a process?

    Posted 15 days ago
      |   view attached
    Hi Paul,

    I am attaching the code here, I tried with Internal id, Project id and name as well. 'Update cost totals' job is running but not picking any parameter value.

    Thanks,
    Jeevana.

    Attachment(s)

    xml
    Job script.xml   3 KB 1 version


  • 4.  RE: How to run parametrized Job through a process?

    Posted 15 days ago
    Thanks for this. Let me adjust the identities etc., so I can try it on my system. Just to start things off though, what do the hard coded numbers represent? On my system that job has a job_definition_id of 5000046.

    Paul


  • 5.  RE: How to run parametrized Job through a process?

    Posted 15 days ago
    Hi Paul,


    1st hardcoded value - 5254330 , is the Scheduled job ID(we need to schedule 'Update cost Totals' job and give this ID in the script, so every time the process picks this Scheduled job and run it)
    2nd  hardcoded value - 5088731, is the Idea Internal id

    Please let me know if you figure out things I am missing ?

    Thanks,
    Jeevana.


  • 6.  RE: How to run parametrized Job through a process?

    Posted 14 days ago
      |   view attached
    Hello again,

    I'm assuming that the job you mean is the Update Earned Value and Cost Totals job, but that's a detail. In my system that has an internal Job ID of 5000046. Here is what I did.

    1) Created a scheduled job for that job with no end date that runs on Sundays, with a start date in the future:

    This scheduled job has an internal ID of 5042064.

    2) Next I created a job process on the project object using the script you attached as the base, but with some minor changes. The main ones are the Job ID is picked up from a parameter and the Project ID is determined at run time, rather than hard-coding them. I've attached the script to this reply.

    3) I opened the project, navigated to the processes tab and executed the process. The log looks like this:
    Which suggests the process has scheduled the job.

    4) I went into the Scheduled Job and navigated to the instances that have been executed and it looks like the job ran OK:

    Is that what you need, or have I misunderstood?

    Paul

    Attachment(s)

    xml
    Job script.xml   3 KB 1 version


  • 7.  RE: How to run parametrized Job through a process?

    Posted 13 days ago
    Hi Paul,

    Thanks for trying this out.

    Could you please confirm if the Job is picking that particular project instance or running for all? Even before the job is running for me but not picking particular Project/Idea.




  • 8.  RE: How to run parametrized Job through a process?

    Posted 13 days ago
    Apologies for not checking that. The job is being run with the parameters all blank, and hence for all projects as you say. I'll take another look. Just one more question though... Is the intention to generalise the script so that it calls the job for several projects, or is the number of projects (or ideas) very small and the ones it needs to run for are known in advance?


  • 9.  RE: How to run parametrized Job through a process?

    Posted 13 days ago
    I tried this again using the original code from here: https://community.broadcom.com/communities/community-home/digestviewer/viewthread?MID=771138#bm04e7d33d-4d0a-4ea1-9daf-c76127aa8ecd (I guess this is where you found the example as it looks very similar), but that didn't work either. The job executes for all projects. I don't know what the issue is as the original says it worked fine. I'll continue digging....



  • 10.  RE: How to run parametrized Job through a process?

    Posted 10 days ago
    Hi Paul,

    Yes, you are right. The thread you mentioned is where I got the code.

    Thank you so much for your help, Please help me resolve this issue.

    Thanks,
    Jeevana.


  • 11.  RE: How to run parametrized Job through a process?

    Posted 3 days ago
    Hi Paul,

    Any luck on this issue?

    Thanks,
    Jeevana.


  • 12.  RE: How to run parametrized Job through a process?

    Posted 3 days ago
    I've posted my findings twice on this thread but they don't seem to stick.

    I'll try again without the code.

    Basically I set up all four parameters (the last 3 being null) and then echoed the parameters back again after oulling them back again as in the original code.

    They are all blank so I think that setting the parameters doesn't work as expected.