Ciao Fabio,
This gel takes a document from an attachment attribute from a custom object and insert it to an idea. Not exactly what you want but might help you on the way.
The key is the argument in the read xog: <args name="documentLocation" value="C:\CA\Clarity\filestore"/>
<gel:script xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:q="http://www.niku.com/xog/Query"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="jelly:sql" xmlns:util="jelly:util" xmlns:x="jelly:xml"
xmlns:xog="http://www.niku.com/xog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<gel:setDataSource dbId="niku"/>
<!-- get info -->
<core:set value="Java version: ${java.version}" var="logMessage"/>
<gel:formatDate format="dd MMM yy HH:mm:ss.SSS" stringVar="logDate"/>
<core:set value="${logDate} - ${logMessage}" var="logMessage"/>
<gel:log level="INFO">${logMessage}</gel:log>
<core:invokeStatic className="java.util.ResourceBundle" method="getBundle" var="xog_version">
<core:arg type="java.lang.String" value="xog"/>
</core:invokeStatic>
<core:set value="XOG/GEL version: ${xog_version.getString('version')}" var="logMessage"/>
<gel:formatDate format="dd MMM yy HH:mm:ss.SSS" stringVar="logDate"/>
<core:set value="${logDate} - ${logMessage}" var="logMessage"/>
<gel:log level="INFO">${logMessage}</gel:log>
<!-- invoke -->
<core:new className="com.niku.xog.client.XOGClientInterface" var="xogcaller"/>
<core:new className="com.niku.xog.client.XOGAdminClient" var="xogadminclient"/>
<core:invokeStatic className="com.niku.union.config.ConfigurationManager" method="getInstance" var="thisClarityConfig"/>
<sql:query escapeText="false" var="todayQuery">
select convert(char, getdate(), 120) as theDate from dual
</sql:query>
<core:forEach items="${todayQuery.rows}" var="todayQueryRow">
<core:set var="today">${todayQueryRow.theDate}</core:set>
</core:forEach>
<!-- get session -->
<core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="secId"/>
<core:invokeStatic className="com.niku.union.security.UserSessionControllerFactory" method="getInstance" var="userSessionCtrl"/>
<core:set value="${userSessionCtrl.init('admin', secId)}" var="secId"/>
<core:set value="${secId.getSessionId()}" var="thisSessionId"/>
<core:set value="XOG Session ID: ${thisSessionId}" var="logMessage"/>
<gel:formatDate format="dd MMM yy HH:mm:ss.SSS" stringVar="logDate"/>
<core:set value="${logDate} - ${logMessage}" var="logMessage"/>
<gel:log level="INFO">${logMessage}</gel:log>
<!-- get xog url -->
<core:set value="${thisClarityConfig.getProperties().getWebServer().getSchedulerUrl()}" var="clarity_url"/>
<core:if test="${clarity_url == ''}">
<core:switch on="${thisClarityConfig.getProperties().getWebServer().getWebServerInstance(0).getId()}">
<core:case value="nsa">
<core:set value="${thisClarityConfig.getProperties().getWebServer().getWebServerInstance(1).getEntryUrl()}" var="clarity_url"/>
</core:case>
<core:default>
<core:set value="${thisClarityConfig.getProperties().getWebServer().getWebServerInstance(0).getEntryUrl()}" var="clarity_url"/>
</core:default>
</core:switch>
</core:if>
<util:tokenize delim=":" var="urlComponents">${clarity_url}</util:tokenize>
<core:set value="${urlComponents.get(0)}://" var="httpMethod"/>
<core:set value="${urlComponents.get(1)}" var="servername"/>
<util:tokenize delim="/" var="servername">${servername}</util:tokenize>
<core:set value="${servername.get(0)}" var="servername"/>
<core:set value="${urlComponents.get(2)}" var="portnumber"/>
<core:choose>
<core:when test="${portnumber == null}">
<core:switch on="${httpMethod}">
<core:case value="https://">
<core:set var="portnumber">443</core:set>
</core:case>
<core:default>
<core:set var="portnumber">80</core:set>
</core:default>
</core:switch>
</core:when>
<core:otherwise>
<util:tokenize delim="/" var="portnumber">${portnumber}</util:tokenize>
<core:set value="${portnumber.get(0)}" var="portnumber"/>
</core:otherwise>
</core:choose>
<core:set value="${httpMethod}${servername}:${portnumber}/niku/xog" var="clarity_url"/>
<core:set value="XOG URL: ${clarity_url}" var="logMessage"/>
<gel:formatDate format="dd MMM yy HH:mm:ss.SSS" stringVar="logDate"/>
<core:set value="${logDate} - ${logMessage}" var="logMessage"/>
<gel:log level="INFO">${logMessage}</gel:log>
<!--=================== Get Standardobjekt info and attachement file info ===================-->
<sql:query escapeText="false" var="v_qryresult">
select stand.id stand_id
, stand.name stand_name
, stand.code stand_code
, stand.stand_a_date stand_date
, stand.stand_a_comment stand_comment
, stand.z_stand_a_text stand_text
, files.NAME file_name
, files.MIME_TYPE file_mime_type
, files.LANGUAGE file_language
, (left(ltrim(CONVERT(VARCHAR(19), files.FILE_CREATED_DATE, 120)),10) + 'T' + right(rtrim(CONVERT(VARCHAR(19), files.FILE_CREATED_DATE, 120)),8)) file_created_date
, version.id version_id
from odf_ca_standardbastall_a stand
join CLB_DMS_FOLDERS folders on folders.assoc_obj_id = stand.id
join CLB_DMS_FILES files on files.PARENT_FOLDER_ID = folders.ID
join CLB_DMS_VERSIONS version on version.file_id = files.id
where stand.id = ${gel_objectInstanceId}
</sql:query>
<!--=================== Store attributes ===================-->
<core:forEach trim="true" items="${v_qryresult.rowsByIndex}" var="row">
<core:set var="stand_id" value="${row[0]}"/>
<core:set var="stand_name" value="${row[1]}"/>
<core:set var="stand_code" value="${row[2]}"/>
<core:set var="stand_date" value="${row[3]}"/>
<core:set var="stand_comment" value="${row[4]}"/>
<core:set var="stand_text" value="${row[5]}"/>
<core:set var="file_name" value="${row[6]}"/>
<core:set var="file_mime_type" value="${row[7]}"/>
<core:set var="file_language" value="${row[8]}"/>
<core:set var="file_created_date" value="${row[9]}"/>
<core:set var="version_id" value="${row[10]}"/>
<!--=================== Parse XOG read of the custom instace to load the attachment to filestore ===================-->
<gel:parse var="load_attachment">
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
<Header version="8.0" action="read" objectType="customObjectInstance" externalSource="NIKU">
<args name="documentLocation" value="C:\CA\Clarity\filestore"/>
</Header>
<CustomObjectInstanceQuery>
<Filter name="objectCode" criteria="EQUALS">standardbastall_a</Filter>
<Filter name="instanceCode" criteria="EQUALS">${row[2]}</Filter>
</CustomObjectInstanceQuery>
</NikuDataBus>
</gel:parse>
<!--=================== Run the parsed xog read file ===================-->
<core:choose>
<core:when test="${thisSessionId == null}">
<gel:log category="XOG" level="ERROR">Couldn't Log in to XOG. Please verify the username/password.</gel:log>
</core:when>
<core:otherwise>
<core:catch var="v_xog_exception">
<soap:invoke endpoint="${clarity_url}" var="vResults">
<soap:message>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${thisSessionId}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<gel:include select="$load_attachment"/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
</core:catch>
<core:choose>
<core:when test="${v_xog_exception != null}">
<gel:log category="XOG Failed" level="ERROR">XOG failed: ${v_xog_exception}</gel:log>
</core:when>
<core:otherwise>
<gel:log><gel:expr select="$vResults"/></gel:log>
</core:otherwise>
</core:choose>
</core:otherwise>
</core:choose>
<!--=================== Parse the write file ===================-->
<gel:parse var="load_idea">
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_idea.xsd">
<Header action="write" externalSource="NIKU" objectType="idea" version="8.0" />
<Ideas>
<Idea active="true" name="${row[1]}" objectID="${row[2]}" openForTimeEntry="1" pageLayoutCode="pma.ideaFrame">
<CustomInformation>
<ColumnValue name="obj_fast_track">false</ColumnValue>
<ColumnValue name="obj_request_category"></ColumnValue>
<ColumnValue name="obj_request_type"></ColumnValue>
<ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>
<ColumnValue name="obj_work_status">REQUESTED</ColumnValue>
<ColumnValue name="z_bifoga">
<Documents>
<Parent documentLocation="C:\CA\Clarity\filestore">
<Document fileCreatedDate="${row[9]}" language="${row[8]}" mimeType="${row[7]}" name="${row[6]}">
<Version id="${row[10]}" versionNumber="1"/>
</Document>
</Parent>
</Documents>
</ColumnValue>
</CustomInformation>
</Idea>
</Ideas>
</NikuDataBus>
</gel:parse>
<!--=================== Run the parsed xog write file ===================-->
<core:choose>
<core:when test="${thisSessionId == null}">
<gel:log category="XOG" level="ERROR">Couldn't Log in to XOG. Please verify the username/password.</gel:log>
</core:when>
<core:otherwise>
<core:catch var="v_xog_exception">
<soap:invoke endpoint="${clarity_url}" var="vResults">
<soap:message>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${thisSessionId}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<gel:include select="$load_idea"/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
</core:catch>
<core:choose>
<core:when test="${v_xog_exception != null}">
<gel:log category="XOG Failed" level="ERROR">XOG failed: ${v_xog_exception}</gel:log>
</core:when>
<core:otherwise>
<gel:log><gel:expr select="$vResults"/></gel:log>
</core:otherwise>
</core:choose>
</core:otherwise>
</core:choose>
</core:forEach>
<core:if test="${load_idea != null}">
<gel:log level="WARNING">An error occurred :</gel:log>
<gel:log level="WARNING">${load_idea}</gel:log>
</core:if>
<core:if test="${load_attachment != null}">
<gel:log level="WARNING">An error occurred :</gel:log>
<gel:log level="WARNING">${load_attachment}</gel:log>
</core:if>
</gel:script>