Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!

Query Activity in WebApp

Avatar

Level 4

Hello All,

 

I am on v8 and using the Out of Box available newWebApp template to create our WebApp.

This template has a Query Activity, which we would like to use

dipendu_g_0-1686032903114.png

We would want to parameterize, this activity like we do for workflow, for ex in the filter clause we would like to use something like $(ctx/vars/@email).

 

When we use this in the activity, and later run we get the following error

XTK-170018 Parameter of query 'ctx/vars/@email' is not defined in current context.

 

Is parameterization, possible here ? 

Please help 

 

 

 

Regards,

DG

 

 

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

9 Replies

Avatar

Community Advisor

Hi @dipendu_g 

 

You can try by defining a variable in the properties tab, then assigning the declared variable in the javascript as 

var query = xtk.queryDef.create(
    <queryDef schema="schemaName" operation="select">
    <select>
    <node expr="@email"/>    
    </select>
<where>
    <condition expr={"[@CONTACT_ID] ='"+ ctx.schemaName.@CONTACT_ID + "'"} />
</where>
    </queryDef>);

var res = query.ExecuteQuery();

for each (var rcp in res)
{
      ctx.vars.varibale1 = res.@email;
}

and then try calling the declared variable in activity.

 

Hope this helps.

 

Regards

A

Avatar

Level 4

Hi @AkshayAnand ,

 

I was unable to understand your solution. Actually the WebApp is passed with an email id, I already tried by

1. Assigning that email id to a context variable

2. Assigning that email id to a variable declared using the properties tab.

 

In both the above cases, when the variable was referenced back in the Query activity, it gave the error.

 

dipendu_g_0-1686054411764.png

 

Regards,

DG

 

 

 

 

 

Avatar

Community Advisor

Hi @dipendu_g 

 

Apologies if I wasn't clear. 

I was stating that in Properties >> Variables tab, you can declare a new variable as 

AkshayAnand_0-1686055568476.png

 

After declaration of the variable, use a javascript activity and QueryDef method to assign the declared variable as shown above. After which you will be able to see that variable in the preview tab after switching to debug mode. Also you can try to log that variable and check in the logs of web@default.in the Home >> monitoring tab under Processes List.

AkshayAnand_2-1686056573349.png

Once you are able to see the variable flowing into the webapp workflow, trying calling it in the query activity.

 

Regards

A

Avatar

Level 4

Hi @AkshayAnand ,

 

Still the same issue

dipendu_g_0-1686061088361.png

pEmail is defined as the variable

 

Regards,

DG

Avatar

Community Advisor

Hi @dipendu_g 

 

Could you please try as $(ctx/vars/@pEmail).

 

Regards

A

Avatar

Level 4

Hi @AkshayAnand ,

 

Have tried that as well. Same result

 

Regards,

DG

Avatar

Community Advisor

Hi @dipendu_g ,

 

Please try this approach also:

 

In the Webapp Properties Tab , please define a variable as below:

 

LakshmiPravallika_0-1686311144110.png

Also in the webapp, please pull the query activity and give the filtering condition as below

 

LakshmiPravallika_1-1686311207212.png

Syntax: $(ctx/vars/@Email)

 

Please test this and let me know if you face any issues.

 

Regards,

Pravallika.

Avatar

Level 1

Hi,

 please try below:

$([vars/email])