Netiq driver policy to fetch an date and time attribute and add 23 hr to it and store it in a new attribute , While converting date and time and storing it is giving pub-ctp-SetDefaultAttribute#XmlData:200: Couldn't convert date/time '': java.t

 Hi Team ,

We are working on a Netiq driver policy to fetch an date and time attribute and add 23 hr to it and store it in a new attribute . While converting date and time and storing it is giving pub-ctp-SetDefaultAttribute#XmlData:200: Couldn't convert date/time '': java.text.ParseException: Unparseable date: .

Please provide a policy for this .

Thanks

  • 0  

    It would be the most efficient if you would provide trace level 3 or higher (event before the policy executing, trace of the policy and after)

  • 0 in reply to   

    Applying rule 'User: set loginExpirationTime '.

    [10/25/24 12:23:36.649]:csvfilemaker.log PT: Action: do-set-local-variable("Expiration",scope="policy",token-op-attr("sExpiryDate")).

    [10/25/24 12:23:36.649]:csvfilemaker.log PT: arg-string(token-op-attr("sExpiryDate"))

    [10/25/24 12:23:36.650]:csvfilemaker.log PT: token-op-attr("sExpiryDate")

    [10/25/24 12:23:36.650]:csvfilemaker.log PT: Token Value: "31-Oct-24".

    [10/25/24 12:23:36.650]:csvfilemaker.log PT: Arg Value: "31-Oct-24".

    [10/25/24 12:23:36.650]:csvfilemaker.log PT: Action: do-set-local-variable("Expiration",scope="policy",token-time(format="dd-MMM-yy",lang="en-GB",tz="UTC")).

    [10/25/24 12:23:36.651]:csvfilemaker.log PT: arg-string(token-time(format="dd-MMM-yy",lang="en-GB",tz="UTC"))

    [10/25/24 12:23:36.651]:csvfilemaker.log PT: token-time(format="dd-MMM-yy",lang="en-GB",tz="UTC")

    [10/25/24 12:23:36.652]:csvfilemaker.log PT: Token Value: "25-Oct-24".

    [10/25/24 12:23:36.652]:csvfilemaker.log PT: Arg Value: "25-Oct-24".

    [10/25/24 12:23:36.652]:csvfilemaker.log PT: Action: do-set-local-variable("Expiration",scope="policy",token-convert-time(dest-format="dd-MMM-yy hh:mm:ss",dest-lang="en-GB",dest-tz="UTC",offset="82799",offset-unit="second",src-format="dd-MMM-yy",src-lang="en-GB",src-tz="UTC")).

    [10/25/24 12:23:36.653]:csvfilemaker.log PT: arg-string(token-convert-time(dest-format="dd-MMM-yy hh:mm:ss",dest-lang="en-GB",dest-tz="UTC",offset="82799",offset-unit="second",src-format="dd-MMM-yy",src-lang="en-GB",src-tz="UTC"))

    [10/25/24 12:23:36.654]:csvfilemaker.log PT: token-convert-time(dest-format="dd-MMM-yy hh:mm:ss",dest-lang="en-GB",dest-tz="UTC",offset="82799",offset-unit="second",src-format="dd-MMM-yy",src-lang="en-GB",src-tz="UTC")

    [10/25/24 12:23:36.655]:csvfilemaker.log PT: token-convert-time(dest-format="dd-MMM-yy hh:mm:ss",dest-lang="en-GB",dest-tz="UTC",offset="82799",offset-unit="second",src-format="dd-MMM-yy",src-lang="en-GB",src-tz="UTC")

    [10/25/24 12:23:36.656]:csvfilemaker.log PT: Arg Value: "".

    [10/25/24 12:23:36.656]:csvfilemaker.log PT:

    DirXML Log Event -------------------

    Driver: \DEFV_TREE\driverset\Filemaker

    Channel: Publisher

    Object: (S\Accounts\Active\Students\99999)

    Status: Warning

    Message: Code(-8033) Error in vnd.nds.stream://DEV_TREE//driverset/Filemaker/Publisher/custom-pub-ctp-SetDefaultAttribute#XmlData:200: Couldn't convert date/time '': java.text.ParseException: Unparseable date: ""

    [10/25/24 12:23:36.657]:csvfilemaker.log PT: Token Value: "".

    [10/25/24 12:23:36.658]:csvfilemaker.log PT: Arg Value: "".

  • Suggested Answer

    0   in reply to 

    Ok, I have created a policy you probably have created in your environment:

    <rule>
    	<description>testing</description>
    	<conditions>
    		<and/>
    	</conditions>
    	<actions>
    		<do-set-local-variable name="Expiration" scope="policy">
    			<arg-string>
    				<token-op-attr name="soasExpiryDate"/>
    			</arg-string>
    		</do-set-local-variable>
    		<do-set-local-variable name="Expiration" scope="policy">
    			<arg-string>
    				<token-time format="dd-MMM-yy" tz="UTC"/>
    			</arg-string>
    		</do-set-local-variable>
    		<do-set-local-variable name="Expiration" scope="policy">
    			<arg-string>
    				<token-convert-time dest-format="dd-MMM-yy hh:mm:ss" dest-tz="UTC" offset="23" offset-unit="hour" src-format="dd-MMM-yy" src-tz="UTC"/>
    			</arg-string>
    		</do-set-local-variable>
    	</actions>
    </rule>

    few notes:

    • these are 3 commands, they all just only set local variable, which will not be moved to the connected system if it is not transferred somewhere else somehow:
      • first one sets "Expiration" named variable to the value of "soasExpiryDate" operational attribute
      • second one sets "Expiration" named variable to the value of the current time (in your specified format)
      • third one sets "Expiration" named variable to the value of NOTHING (this is why error is thrown) because you have not specified the value, you just specified convert verb which is missing a value to convert, or something like that (you were missing yellow part):

    • also, you were using seconds for your offset unit, which I deemed unecessary so I changed it to hours so it makes it more clear what is actually doing when reviewing the code

    This is what I would do based on my limited knowledge of your requirements:

    <rule>
    	<description>testing</description>
    	<conditions>
    		<and/>
    	</conditions>
    	<actions>
    		<do-clone-op-attr dest-name="NEWsoasExpiryDate" src-name="soasExpiryDate"/>
    		<do-reformat-op-attr name="NEWsoasExpiryDate">
    			<arg-value type="string">
    				<token-convert-time dest-format="dd-MMM-yy HH:mm:ss" dest-tz="UTC" offset="23" offset-unit="hour" src-format="dd-MMM-yy" src-tz="UTC">
    					<token-local-variable name="current-value"/>
    				</token-convert-time>
    			</arg-value>
    		</do-reformat-op-attr>
    	</actions>
    </rule>

    this is the trace:

    <nds dtdversion="4.0" ndsversion="8.x">
      <source>
        <product version="4.8.5.0100">DirXML</product>
        <contact>NetIQ Corporation</contact>
      </source>
      <input>
        <add class-name="User">
          <add-attr attr-name="soasExpiryDate">
            <value type="string">31-Oct-24</value>
          </add-attr>
        </add>
      </input>
    </nds>
    Zan-Testing :Applying policy: %+C%14CGNLNULL-sub-etp-TestJob%-C.
    Zan-Testing :  Applying to add #1.
    Zan-Testing :    Evaluating selection criteria for rule 'testing'.
    Zan-Testing :    Rule selected.
    Zan-Testing :    Applying rule 'testing'.
    Zan-Testing :      Action: do-clone-op-attr("soasExpiryDate","NEWsoasExpiryDate").
    Zan-Testing :      Action: do-reformat-op-attr("NEWsoasExpiryDate",token-convert-time(dest-format="dd-MMM-yy HH:mm:ss",dest-tz="UTC",offset="23",offset-unit="hour",src-format="dd-MMM-yy",src-tz="UTC",token-local-variable("current-value"))).
    Zan-Testing :        arg-string(token-convert-time(dest-format="dd-MMM-yy HH:mm:ss",dest-tz="UTC",offset="23",offset-unit="hour",src-format="dd-MMM-yy",src-tz="UTC",token-local-variable("current-value")))
    Zan-Testing :          token-convert-time(dest-format="dd-MMM-yy HH:mm:ss",dest-tz="UTC",offset="23",offset-unit="hour",src-format="dd-MMM-yy",src-tz="UTC",token-local-variable("current-value"))
    Zan-Testing :            token-convert-time(dest-format="dd-MMM-yy HH:mm:ss",dest-tz="UTC",offset="23",offset-unit="hour",src-format="dd-MMM-yy",src-tz="UTC",token-local-variable("current-value"))
    Zan-Testing :              token-local-variable("current-value")
    Zan-Testing :                Token Value: "31-Oct-24".
    Zan-Testing :              Arg Value: "31-Oct-24".
    Zan-Testing :            Token Value: "31-Oct-24 23:00:00".
    Zan-Testing :          Arg Value: "31-Oct-24 23:00:00".
    Zan-Testing :    Evaluating selection criteria for rule 'break'.
    Zan-Testing :    Rule selected.
    Zan-Testing :    Applying rule 'break'.
    Zan-Testing :      Action: do-break().
    Zan-Testing :Policy returned:
    Zan-Testing :
    <nds dtdversion="4.0" ndsversion="8.x">
      <source>
        <product version="4.8.5.0100">DirXML</product>
        <contact>NetIQ Corporation</contact>
      </source>
      <input>
        <add class-name="User">
          <add-attr attr-name="soasExpiryDate">
            <value type="string">31-Oct-24</value>
          </add-attr>
          <add-attr attr-name="NEWsoasExpiryDate">
            <value type="string">31-Oct-24 23:00:00</value>
          </add-attr>
        </add>
      </input>
    </nds>
    

    Quick explanation of commands:

    • first clones current "soasExpiryDate" to "NEWsoasExpiryDate"
    • second reformats the "NEWsoasExpiryDate" attribute with time convert verb using the current-value of the "NEWsoasExpiryDate" value

    One more thought: You are converting from time where you don't have a specified time in hours to the one where you have it. I don't think this is a good thing, but you probably have a good reason for it.

    Hopefully this was all clear enough.