Need a solution to restart a Workflow automatically

Avatar

Avatar
Validate 1
Level 1
Ofattah
Level 1

Likes

0 likes

Total Posts

14 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Ofattah
Level 1

Likes

0 likes

Total Posts

14 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
Ofattah
Level 1

12-06-2021

Hello Everyone,

So far you were very helpful and I really appreciate that!

I'm a new user of Adobe Campaign Classic and I'm facing a problem with some of my workflows.

Some of the workflows I made stops from running because of an error ; ORA-210000  (timeout occurred)

Ofattah_0-1623530683845.png

The problem is not due to our database since it's running and there's no issue with it.

My question is, is there any workflow I can build that can restart the workflows that stop from running, please?

Thanks.

 

 

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

13-06-2021

Hi,

 

It's not normal to have db connection regularly die at random.

If the db is fine try adjusting client settings?

 

Thanks,

-Jon

Avatar

Avatar
Affirm 5
Level 3
LaurentLam
Level 3

Likes

18 likes

Total Posts

57 posts

Correct reply

7 solutions
Top badges earned
Affirm 5
Boost 10
Contributor
Applaud 5
Affirm 3
View profile

Avatar
Affirm 5
Level 3
LaurentLam
Level 3

Likes

18 likes

Total Posts

57 posts

Correct reply

7 solutions
Top badges earned
Affirm 5
Boost 10
Contributor
Applaud 5
Affirm 3
View profile
LaurentLam
Level 3

13-06-2021

You could build a workflow that will scan all the "production" workflows status and use api command like:

Restart (adobe.com)

You create a workflow with the query activity linked to a JS activity.

In the JS, you use a query def function with "vars.targetSchema" as schema declaration: it will select automatically the content of your previous query activity

Data oriented APIs | Adobe Campaign

 

Then you loop on the query result in order to execute your restart function

 

Netherless, you have a connection issue with the DB and your AC instance and you should spend time to investigate the root cause as restarting automatically workflows due to this problem is for having a better resilience while the issue is addressed

Ofattah

Hi @LaurentLam 

Thank you for your response,

Do you have any page where this kind of workflow is explained, please? I'm not sure I got all of what you described;

Is this the code I need to put in the JS activity ?

vars.targetSchema

          Restart (
         String
         workflowId
)

Then after the JS activity I just end the workflow there?

Thank you 

LaurentLam

Hi, I do not have ACC on this laptop unfortunately so I cannot develop it with you. But no, that's not the code at all I'm describing: you can inspire yourself about this code I've just wrote in notepad:

 

var wkf2restart = NLWS.xtkQueryDef.create(

<queryDef schema={vars.targetSchema} operation="select">

   <select>

       <node expr="@internalName"/>

   </select>

</queryDef>

);

 

var workflows = wkf2restart.ExecuteQuery()

 

for each(var workflow in workflows.*) {

  logInfo("restarting :" + workflow.@internalName);

  xtk.workflow.restart(workflow.@internalName);

}

Ofattah

Hi @LaurentLam 

 

Thank you so much. 

I will test it ASAP. It would be great if it works until we figure out the root of the problem.

 

Thanks

Ofattah

Hi @LaurentLam 

I tried to implement the workflow you described and the code you provided to test what would happen to my "not running workflows" but got this error 

Ofattah_0-1623689506978.png

Here's the query I associated with the JS activity.

Ofattah_1-1623689564961.png

It seems that I did something wrong. 

Thank you

 

LaurentLam
This is because you have to add internalName attribute in the additonal data of the query.
Ofattah

Hi @LaurentLam 

 

I put this query 

@InternalName (equal) WKFxxxx (it's the workflow I want to restart if it stops)

and

@State (not equal) Started

Ofattah_0-1623918857001.png

 

Then I attached it to the code you provided but I got the error.

 

Thanks for your help

LaurentLam
@Ofattah, in workflow query activity you have 2 sections: the query itself (what you've done) and the additional data section... This is in this one you need to add internalName information. If you don't put here an attribute that you are calling in a JS activity... It won't work
Ofattah

@LaurentLam 

Thank you for all your responses.

After adding the additional data @internalName

I no longer have that error but I got this one this time, I think it's a code error *

Ofattah_0-1623931821636.png

Here's the code I used :

 

 

var wkf2restart = NLWS.xtkQueryDef.create(

<queryDef schema={vars.targetSchema} operation="select">

   <select>

      <node expr="@internalName"/>

   </select>

</queryDef>

);

 

var workflows = wkf2restart.ExecuteQuery()

 

for each(var workflow in workflows.getElement()) {

   logInfo("restarting :" + workflow.@internalName);

   xtk.workflow.restart(workflow.@internalName);

}

LaurentLam
I just updated my code with workflows.* instead of workflows.getElement()
Ofattah

Hi @LaurentLam 

It seems that this code doesn't like me. It's still making errors 

Ofattah_0-1623946779117.png

Here's my code box in case.

Ofattah_1-1623946832185.png

 

 

I can't thank you enough for your time and help

LaurentLam
Sorry but you should ask your neolane administrator / neolane developper a hand on it: the error message you get doesn't seem related to the code. there is no code line 22 and no variable called "AnyName" has been used...
Ofattah

Hi @LaurentLam 

Thank you for your help and all your responses 🙂