Just to get you steered in a simpler direction ; what I mean by cutting down the XML that you need to construct is....
You have so far worked out what a "write XML" for your custom object needs to look like, it is this (copied directly from your post above);
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd"><Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.7.1.270"/><customObjectInstances objectCode="tbs_casereview_opi"><instance instanceCode="FDBK-0104" objectCode="tbs_casereview_opi" parentInstanceCode="FILE-0134" parentObjectCode="goc_tbs_ocio_caserev"><CustomInformation><ColumnValue name="tbs_case_opiname">6</ColumnValue><ColumnValue name="tbs_case_status">Draft</ColumnValue><ColumnValue name="tbs_file_opi_decisio">7</ColumnValue><ColumnValue name="tbs_file_round">5</ColumnValue><ColumnValue name="odf_cncrt_parent_id">5011001</ColumnValue><ColumnValue name="partition_code">NIKU.ROOT</ColumnValue><ColumnValue name="odf_parent_id">5011001</ColumnValue><ColumnValue name="tbs_case_linkguide">https://gcxxxxxxxxxxxxxxxxxocs/llisapi.dll?func=ll&objaction=overview&objid=36813189</ColumnValue><ColumnValue name="code">FDBK-0104</ColumnValue><ColumnValue name="name">OPI Feedback</ColumnValue></CustomInformation><OBSAssocs complete="false"/><Security><UserSecurity rightCode="odf_cst_tbs_casereview_opi_edit" userName="xxxxx"/></Security></instance></customObjectInstances>But when I'm saying "minimal" I mean that you don't need all that, you probably only need;
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd"><Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.7.1.270"/><customObjectInstances objectCode="tbs_casereview_opi"><instance instanceCode="FDBK-0104" objectCode="tbs_casereview_opi" parentInstanceCode="FILE-0134" parentObjectCode="goc_tbs_ocio_caserev"><CustomInformation/><OBSAssocs complete="false"/><Security><UserSecurity rightCode="odf_cst_tbs_casereview_opi_edit" userName="xxxxx"/></Security></instance></customObjectInstances> (I've just ripped out all the "custom info" as you are not going to be updating that)
So that's a bit less daunting!
And the final XML that you need to produce will be something like;
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd"><Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.7.1.270"/><customObjectInstances objectCode="tbs_casereview_opi"><instance instanceCode="FDBK-0104" objectCode="tbs_casereview_opi" parentInstanceCode="FILE-0134" parentObjectCode="goc_tbs_ocio_caserev"><CustomInformation/><OBSAssocs complete="false"/><Security><UserSecurity rightCode="odf_cst_tbs_casereview_opi_edit" userName="xxxxx"/><GroupSecurity groupCode="ZZZZZZZ" rightCode="XXXXXXXXX"/>
</Security></instance></customObjectInstances> (If you XOG out an instance with the correct group security set up in the application then you shoudl see the correct values for that bit of bold text I've added into the XML above)
So you
could read out the full XML, add the one line you are needing to add and XOG it back in again
OR
you could construct that "minimal XML" on its own and just XOG it in. You would need to run a SQL query first just to pull from the database the value values you needed to construct the XML (so just
FDBK-0104 and
FILE-0134 I think)
(sorry for the stream of info. - I'm just adding detail to what I said earlier though)
Original Message:
Sent: 07-22-2020 12:46 PM
From: Chris Thornhill
Subject: Script to update access to record
Alistair, that's a really great document. Thanks so much for that!
I had just written my first XOG script, reading a particular record, in order to determine what i will need to pass back in order to complete the update. Super basic, and hopefully the start of getting this going. Maybe the combination of this, along with your script will help me resolve this sooner rather than later. Reading was one thing...updating may be something entirely different. Just looking at the difference between my basic script, and your (at least at first glance) complex version has me just a little concerned :)
<gel:script
xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:sql="jelly:sql"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
<Header action="read" externalSource="NIKU" objectType="customObjectInstance" version="13.2.0.472">
<args name="tbs_case_opiname" value="false"/>
</Header>
<CustomObjectInstanceQuery>
<Filter name="objectCode" criteria="EQUALS">tbs_casereview_opi</Filter>
<Filter name="instanceCode" criteria="OR">FDBK-0104</Filter>
</CustomObjectInstanceQuery>
</NikuDataBus>
</gel:script>
Results:
<SessionID xmlns="http://www.niku.com/xog">9997154__E3FE0D4C-1A1C-4878-86EF-52BAF9D9A40D</SessionID>
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
<Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.7.1.270"/>
<customObjectInstances objectCode="tbs_casereview_opi">
<instance instanceCode="FDBK-0104" objectCode="tbs_casereview_opi" parentInstanceCode="FILE-0134" parentObjectCode="goc_tbs_ocio_caserev">
<CustomInformation>
<ColumnValue name="tbs_case_opiname">6</ColumnValue>
<ColumnValue name="tbs_case_status">Draft</ColumnValue>
<ColumnValue name="tbs_file_opi_decisio">7</ColumnValue>
<ColumnValue name="tbs_file_round">5</ColumnValue>
<ColumnValue name="odf_cncrt_parent_id">5011001</ColumnValue>
<ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>
<ColumnValue name="odf_parent_id">5011001</ColumnValue>
<ColumnValue name="tbs_case_linkguide">https://gcxxxxxxxxxxxxxxxxxocs/llisapi.dll?func=ll&objaction=overview&objid=36813189</ColumnValue>
<ColumnValue name="code">FDBK-0104</ColumnValue>
<ColumnValue name="name">OPI Feedback</ColumnValue>
</CustomInformation>
<OBSAssocs complete="false"/>
<Security>
<UserSecurity rightCode="odf_cst_tbs_casereview_opi_edit" userName="xxxxx"/>
</Security>
</instance>
</customObjectInstances>
<XOGOutput>
<Object type="customObjectInstance"/>
<Status state="SUCCESS"/>
<Statistics failureRecords="0" insertedRecords="0" totalNumberOfRecords="1" updatedRecords="0"/>
<Records/>
</XOGOutput>
</NikuDataBus>
And the Security tag is the area i'm going to need to udpate.
Thanks again!
Original Message:
Sent: 07-21-2020 04:09 PM
From: Alistair Miller
Subject: Script to update access to record
I have one example that might help. The client required that three key stakeholders (the Project Manager, Portfolio Manager, and Engagement Manager) have access to the project's financials. We created a process that ran on each relevant project and gave each of the people in those roles the required instance rights. I XOGGED out the user record, added the instance rights, and XOGGED the record back in.
The relevant GEL script is attached - I hope it helps but I definitely recommend you getting really familiar with the Gel for Dummies document - it's invaluable.
My XOG (and SQL) skills are rudimentary at best, so anyone reading this, please be kind :)
Original Message:
Sent: 07-21-2020 10:51 AM
From: Chris Thornhill
Subject: Script to update access to record
Well, that's a shame it isn't as easy as i was hoping :)
I'm new to XOG, but i'll review the docs and sections you mentioned, David. Hopefully this isn't too difficult.
Again, thank you for the guidance, and saving me the time i would have spent continuing down the path i was on.
Original Message:
Sent: 07-21-2020 03:24 AM
From: David Morton
Subject: Script to update access to record
As Alistair says; its NOT a SQL statement that you can run to add the access, you have to construct some XML then pass that to the XOG interface.
(you don't necessarily need to XOG out the instance, update it and XOG it back in again, you can just create the (comparatively minimal when compared to the full extracted-from-XOG XML) XML "manually" and XOG that back in - the "trick" is working out what that XML needs to look like and ensuring that you can pull all that information (via SQL) from the system. I don't have a worked example I'm afraid, but I could knock-up some pseudo-code if I am still not making enough sense?)
EDIT : the two examples in Section 4 "Running the XOG" of the old Gel for Dummies document ( which is in a few places these days I think, but I know it is attached in a GEL.zip file to the old FAQ thread here ; CA Clarity General Discussion - FAQs ) would give the right idea.
There is also an example embedded in the Basic guide to getting started with GEL document in that same zip file.