Skip to main content
Nintex Community Menu Bar
Question

run action sequence from snippet

  • July 11, 2024
  • 21 replies
  • 19 views
  • Translate

Forum|alt.badge.img+20

How?

Did this topic help you find an answer to your question?
This topic has been closed for comments

21 replies

Forum|alt.badge.img+20

Two steps closer. Been able to get the object for the sequence I want and run it.

var queryAllRecords = skuid.actionSequences.getByName(‘Query All Records’);

queryAllRecords.run();

How can I set the inputs for the sequence. I assume I have to provide the parameters in the run function. Just dunno what format it needs.

Translate

Forum|alt.badge.img+20

Pretty sure it’s g in the function.

Translate

Forum|alt.badge.img+7
  • Nintex Employee
  • 120 replies
  • July 11, 2024

Any reason against using the skuid.events to publish an event that’ll kick off the action sequence? Via skuid.events it would just look something like this

var obj = {dollars: "1500", pennies:'abc'};<br>skuid.events.publish('hellovent',obj);
Translate

Forum|alt.badge.img+11
  • 340 replies
  • July 11, 2024

We are using this:

        skuid.actionSequences.getByName(“MyActionSequence”).run()

            .then(function(newContext) {

 

                //Actions after calling action here

 

                console.log(“outputs from Data Source Action”, newContext.$PreviousAction.result);

                });


To pass inputs, we are setting variables in the snippet on a UI model and then merge the values into your action.

For example, we use this heavily to create custom chatter posts.  So we have  ‘PostChatter’ action sequence.  I’ve got a UI model that captures “Message” and Parent" (set via snippet) and then calls the action sequence to create the chatter post.


Translate

Forum|alt.badge.img+20

Hmmm … seems intriguing. I’d like to get the best of all options where it’s an Reusable Action Sequence for declarative reasons and an Event-triggered Sequence for javascript reasons.

Translate

Forum|alt.badge.img+20

Yup. I’ve had to resort to using a UI only model as well. Rather not, but alas I could not find a way to set inputs for the action sequence.

Translate

Forum|alt.badge.img+7
  • Nintex Employee
  • 120 replies
  • July 11, 2024

Yeah it’s works out well, and just to clarify the dollars/pennies were Inputs the action sequence was expecting. Just realized that I gave zero explanation for why that extra line was there…

Translate

Forum|alt.badge.img+11

Thanks for sharing your ideas, Matt and Chandra. Glad you have a way to get it working, Pat! Will check in with our product management team about an easier way to do this … 

Thanks!
Karen

Translate

Forum|alt.badge.img+20

Finally got back to this and it works beautifully.  Thanks.

Translate

Forum|alt.badge.img+13

Pat / Chandra,

As of the Millau U2 Release, we adjusted the syntax of the Action Sequences run() function to have named Action Framework Inputs be the first argument that run() accepts. So as of 11.2.x release, the recommended way to do this is the following:

var namedInputs = {<br>&nbsp; &nbsp; "ZipCode": "37408",<br>&nbsp; &nbsp; "TotalPounds": 4.5<br>};<br>skuid.actionSequences.getByName("GetShippingRate").run(namedInputs);


This is the supported way to invoke Action Sequences from JavaScript by name, passing in named inputs.

Translate

Forum|alt.badge.img+20

Perfect. Just updated my code. Thx

Translate

Forum|alt.badge.img+7
  • Nintex Employee
  • 120 replies
  • July 11, 2024

glad to hear it worked out!

Translate

Forum|alt.badge.img+2

Is this compatible/usable to submit an Apex Class?

I am trying to pass Inputs values to a Action Sequence from this snippet script:


var namedInputs = {
    “BaseModelName” : “”,
    “ButtonName”: “TestSubmit”,
    “LayoutObjectName” : “”,
    “LayoutObjectType” : “”,
    “Message” : “This is a test from Skuid page : Snippet”,
    “PageName”: “Logging_Message__Test”,
    “PopupName” : “”,
    “SnippetName” : “newSnippet”
};

skuid.actionSequences.getByName(“WriteLogSequence”).run(namedInputs);


The Action Sequence submits an Apex class (Invocable Method) matching the variables to the parameters on the method. 

Issue is, the apex method is submitted, but no values passed from the Snippet.

IF I set some default values on the Action Sequence , then apex method runs fine.

Any idea?

EDIT:   Skuid  version 11.2.6 

Translate

Forum|alt.badge.img+4

Any updates on this? We are not able to pass parameters to action sequence as indicated in above scenario. This does not work in 11.2.9 also.

Translate

Forum|alt.badge.img+13

Jayesh, just to confirm, you have defined a named Input for each of the parameters you are trying to pass in via the JavaScript snippet?

i.e. if you are trying to do this:

var namedInputs = {
    "hello" : "world",
    "exchangeRate": 1.04,
    "Pizza" : "Mushroom",
};
skuid.actionSequences.getByName("WriteLogSequence").run(namedInputs);

you would need to have declared these Inputs in your Action Sequence:

Translate

Forum|alt.badge.img+4

@Zach sorry for the delayed response on this but this is still an issue for us. We do have the inputs setup on the action sequence. We are also passing in the namedInputs similar to the snippet example you provided.

Translate

Forum|alt.badge.img+13

Hi Jayesh, I will email you directly to try to setup a web meeting to walk through this. 

Translate

Forum|alt.badge.img+4

Zach was kind enough to work with me on this issue. The critical piece of information I was missing was the syntax to refer to the the action sequence inputs in the actions tab section. So for the above e.g. you would refer to the input in the actions section as {{$Input.hello}}

Translate

Forum|alt.badge.img+6

Jayesh, thank you for the feedback, happy to hear that you and Zach could solve the issue!

Translate

Forum|alt.badge.img

As of Skuid 12, .run() supports 2 parameters as follows:

skuid.actionSequences.getByName(“WriteLogSequence”).run(namedInputs, context);where context looks like:<br alt="" name="" rel="" target="" title="" type="" value="" /><pre alt="" name="" rel="" target="" title="" type="" value="">{ row: {}, model: {} }Prior to this, both namedInputs and context were expected as the 1st parameter, so this is a change in Skuid 12 (possibly dates back to 11.2, actually).  If you have a context object in your JS, this will allow your called action sequence to be context aware.

Translate

Forum|alt.badge.img+20

Can you please add this to the documentation.

Translate

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings