Clarity

 View Only
Expand all | Collapse all

Timesheet action items via GEL/XOG or dynamic assignees?

  • 1.  Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Jun 19, 2017 11:46 PM

    Hi,

     

    Is there a way to send action items via XOG or GEL or select timesheet action item assignees dynamically?

     

    My requirement is to sent action items for timesheet approval to multiple resources based on a couple of scenarios. Its not straight logic as to sending actions to thisTimesheet PMs/ RM/ users having time approval right over submitter. Approvers will differ for users based on multiple conditions like who the submitter is/ what projects he has entered time for/ is he a PM and working as non-PM in some task and approvers list will be fetched from db for each timesheet dynamically. So is there a way to enter / assign action item recipients (assignees) at run time - like if I save assignees in a variable in GEL can I assign action items to them? or if I save approvers names in a custom field on resource object, can I assign action items to resources in that field? 

     

    This makes me wonder why CA has still not made timesheet an object.

     

    Thanks,

    Ashmi



  • 2.  Re: Timesheet action items via GEL/XOG or dynamic assignees?
    Best Answer

    Posted Jun 20, 2017 12:20 AM

    I got the solution.. linked resource to timesheet in process. and created a resource browse field in resource obj. I am able to send action items to users selected in that field. will use GEL to dynamically add data to the custom field. Also the field shows up in assignees only if "resource browse" (SCH_BROWSE_RESOURCE) lookup is selected, it does not show up in the list if any other resources lookup is used.



  • 3.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Nov 16, 2017 10:00 AM

    Hi ashmi_ashma,

     

    Our goal is to add Assignees dynamically as well (just found it this as only one solution) to TS approval process. 

    Could you please share that piece of code in GEL script which makes that trick? I think other stuff should be manageable from our side, but I'm not sure how can we add these Assignees via GEL.... 

     

    Thanks a lot,

    Matej



  • 4.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Nov 21, 2017 01:29 AM

    Hi matej256

     

    We cannot dynamically send action item via GEL.

     

    The workaround I used is - create a "Timesheet Approvers" (lets say time_approvers) field on resource object. make sure the look up you select is "SCH_BROWSE_RESOURCE"

     

    Now link the resource obj to timesheet obj in your timesheet process. In process GEL, you can have a query that selects the basic information of timesheet submitter (to be placed in XOG)

    and the names of timesheet approvers (srm_resources.unique_name) and use resource write XOG to update the approvers on resource instance (timesheet submitter) 

     

     

     

     

    <gel:parse var="v_xml_root">
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_resource.xsd">
    <Header action="write" externalSource="NIKU" objectType="resource" version="15.1.0.149"/>
    <Resources>
    <Resource employmentType="${xog_employmentType}" externalId="${xog_externalId}" includeInDatamart="${xog_includeInDatamart}"
    isActive="${xog_isActive}" isExternal="${xog_isExternal}" resourceId="${xog_resourceId}" resourceType="LABOR" username="${xog_username}">
    <PersonalInformation displayName="${xog_displayName}" emailAddress="${xog_emailAddress}" firstName="${xog_firstName}" lastName="${xog_lastName}"/>
    <CustomInformation>
    <ColumnValue name="time_approvers"/>
    </CustomInformation>
    </Resource>
    </Resources>
    </NikuDataBus>
    </gel:parse>

     

    Also, I have multiple timesheet approvers, so I run a loop for timesheet approvers later and fill that in the write XML using gel: insert as below-

     

    <gel:set insert="true" select="$v_xml_root/NikuDataBus/Resources/Resource/CustomInformation/ColumnValue" value="${vApproverUniqueName}"/>

     

    If you have a single approver at all time, you can add ColumnValue Value in the xog and dont need to use gel:insert

     

    This of course depends on what ID you keep for your field in Resource obj. You may create a manual sample write file to see what comes out.

     

    After this XOG sets value in your custom field - Timesheet Approvers on res, you can later have another step in your process that sends action items to the Timesheet Approvers field. But pls make sure you select only SCH_BROWSE_RESOURCE as lookup or else the field will not appear as an option to select to send action items to.

     

    Also, pls be advised that once you have set timesheet approvers, they will not have timesheet approval instance right over the submitter automatically. So you may want to grant them approve time instance right manually or in the process.

     

    Hope this helps!

     

    Thanks,

    Ashmi



  • 5.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Dec 06, 2017 05:13 AM

    Hi ashmi_ashma

     

    many thanks for your tips. Sorry for my late response, I was assigned to other tasks in our company which had higher priority. I can now go back to this. Firstly I used precisely the same lookup you advised me, however when tested simple XOG write (to be used in GEL script), it was not successful. Do you know why? It's really strange for me...

     

    New attribute, lookup ID: "SCH_BROWSE_RESOURCE"

     

    Backup TS approver set for resource:

     

    XOG read successful:

     

    XOG write unsuccessful:

     

    Of course resource ID is valid: 

     

    This really should work. Do you know why not? 

     

    Note: I've just noticed that lookup uses id from srm_resources table as hidden key (that's why it's "Lookup - Number" type), so I've tried to use 

    also ID in this XOG write but without success. 

     

    Thanks

    Matej



  • 6.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Dec 06, 2017 05:13 PM

    Are you able to make your user BOEHMEA the backup timesheet approver through the UI? That will tell you if it's something weird with XOG or if there's something on that user record preventing the XOG from succeeding.

     

    I had exactly the same issue trying to XOG a lookup value into a custom field on the Project object - in my case (I never solved the problem) I assumed it was something to do with the fact it was a MVL and there was something weird with the username.

     

    I'm hoping to use the solution in this thread to selectively send action items on timesheets, so I hope you get to the bottom of the issue.



  • 7.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Dec 07, 2017 02:14 AM

    Of course it works through GUI, question was why I'm getting that error when XOGged in....

     

     

     

    Matej



  • 8.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Jan 04, 2018 06:09 AM

    Hi All, 

     

    I'd like to say that when I put the same XOG read/write into process it worked well. Don't know why it didn't work over the XOG bridge, but finally I was able to complete our process. Now it works fine but only with one PM as Backup TS approver. Have you someone (Jeevan.B) knows how can I add second Project manager there? When I run it in loop, it's added but it's not divided by any colon or anything....

     

    Code:

    <!-- Add Backup TS approver by PM2 -->
    <gel:set insert="true" select="$xogWriteRes//ColumnValue[@name='hen_backup_ts_appr']" value="${res_PM2}"/>

     

    Result in loop (AAGUILAA is PM2 added in first loop, bhata should be PM2 added in second loop):

     

    Then is AI sent correctly for "AAGUILAA", but not for "bhata".

     

    So how can I insert those PMs to Backup TS approver attribute to sent AI to both? 

     

    EDIT: I've just tried to insert also value="$;{res_PM2}" or value="$,{res_PM2}" so the XOG write result was:

     <ColumnValue name="hen_backup_ts_appr">AAGUILAA,bhata</ColumnValue> 

    or

    <ColumnValue name="hen_backup_ts_appr">AAGUILAA;bhata</ColumnValue> 

    but without success. AI was sent only to AAGUILAA,

     

    Also big thanks to ashmi_ashma w ho provided the background functionality for me. 

     

    Matej



  • 9.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Jan 04, 2018 06:43 AM

    Hi Matej!

     

    I think the solution here would be to make this attribute under Resource object an MVL. Right now it seems to be a single select lookup.

     

    Making it an MVL would enable it to hold multiple values, and thereby will also provide us with the ability to Xog In multiple PMs.



  • 10.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Nov 20, 2017 02:40 PM

    I was looking into this. Definitely a nice solution. But just one update. I think all those lookup attributes that are associated with a Lookup whose object is "Resource", are made available for Assignment. Not just the "SCH_BROWSE_RESOURCE" lookup.



  • 11.  Re: Timesheet action items via GEL/XOG or dynamic assignees?

    Posted Nov 21, 2017 01:31 AM

    I tried with other res browse too Jeevan but only the one that has SCH_BROWSE_RESOURCE lookup selected shows up to be selected in action items