cancel
Showing results for 
Search instead for 
Did you mean: 

How to read context variable in To Database Pass and Switch task

Former Member
0 Kudos

Hi All,

I want to read context variables value in  parameter area of 'To Database' pass and Condition part of the 'Switch Task'.

I have used following code to the context values, it is working on 'To Generic' Pass but not in To Database Pass and Switch task.

$function.uGetContextVar(GUID)$$

Please help me to resolve this issue.

Please check the attachments for more information.

Regards,

Venkatesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Venkatesh,

the javascripts are not working everywhere.

For this case you could use the DB-view which contains the context-variables instead.

The SQL would look like this:

select MX_ASYNC_ORIG_OPERATION FROM central_inbox_trans WHERE GUID = (

select VarValue from MXPV_Audit_Variables where varname = 'yourCTX-Variable' and AuditID = %AUDITID%)

I hope this solves your issue.

Best regards,

Gunnar

Former Member
0 Kudos

Hi Gunnar,

Thanks for immediate response. I have tried the query as you suggested. The parameter %AUDITID% is returning empty while using in the 'To Database' Pass.

Is there any other workaround for the same?. Please suggest.

Regards,

Venkatesh

terovirta
Active Contributor
0 Kudos

Are you calling a built-in function from IdM API in the screenshots or do you have your own function called uGetContextVar?

For the %AUDITID% being empty I would have tried to create a wrapper aroudn the uGetAuditID()-function but if the original problem is that the script is not called I am not sure anymore. What happens if you place uWarnings to the script? Will there be output in job log or not?

For the audit id being empty in query:

select MX_ASYNC_ORIG_OPERATION FROM central_inbox_trans WHERE GUID = (

select VarValue from MXPV_Audit_Variables where varname = 'yourCTX-Variable' and AuditID = %AUDITID%)

I would have tried:

select MX_ASYNC_ORIG_OPERATION FROM central_inbox_trans WHERE GUID = (

select VarValue from MXPV_Audit_Variables where varname = 'yourCTX-Variable' and AuditID = $function.zGetAuditId()$$)

function zGetAuditId(Par) {

     var auditId = uGetAuditID();

     return auditId;

}

regards, Tero

Former Member
0 Kudos

I believe Gunnars answer should work well for the switchtask, while your To Database pass needs to use the function, but the return value needs to have quotes around it as the GUID is a string.

select MX_ASYNC_ORIG_OPERATION FROM central_inbox_trans WHERE GUID = '$function.GetAuditId()'

Also make sure that the RT account/role has access to the central_inbox_trans table.

Br,

Per Christian

Answers (0)