Starting a workflow from a Domo App

I've been following the guide (https://developer.domo.com/portal/81056f6209bfc-start-a-workflow-from-an-app) for starting a workflow from an app but have been unable to get it working. When I check the console after attempting to initiate the workflow from the app, I'm getting a 404 error, line 401 from domo.ts "Failed to load resource: the server responded with a status of 404 ()". I'm not experienced with JavaScript and assume the problem is me doing something silly, so maybe someone here can straighten me out!

Here is the code (simplified as much as possible!) initiated by an HTML button:

var domo = window.domo;

function submit() {   

domo.post('/domo/workflow/v1/models/testapp/start', {CaseNo: "123456", EntryID: "1", Fee: 25000.01});

};

Screenshot of the manifest workflows section:

The workflow currently requires 3 parameters to start, but I've also tried a version of the workflow where the 3 parameters were part of an object which also did not work.

Just in case it's relevant, I converted my code from a brick to an app and the app is currently part of an Domo apps page.

Thanks for any advice!

Best Answer

  • jaden.hoenes
    jaden.hoenes Domo Employee
    Answer ✓

    I'm excited you're trying to use workflows and pro-code apps! I've looked into this and it looks like the pro-code editor has a bug resulting in this 404 error being returned. I will create a ticket to get this resolved.

    That being said, there is a workaround you can use to get moving. Here are the steps:

    1. Find the title of your workflows start shape, by default this is "Start {workflowName}"

    2. Open the Json editor for your manifest.json file in the pro-code editor

    3. Edit the "startName" property on your workflow mapping to be equal to the title for your workflows start
    shape

    4. Finally, save the manifest.json file to refresh the app preview so you can start your app!

    Please let me know if this doesn't work for you and we can troubleshoot further.

Answers

  • DanHendriksen
    DanHendriksen Domo Employee

    Can you show me the workflow start shape showing required parameters, and can you show me the part of your app where you're making the call? Specifically the JS where you're making this call.

  • jaden.hoenes
    jaden.hoenes Domo Employee
    Answer ✓

    I'm excited you're trying to use workflows and pro-code apps! I've looked into this and it looks like the pro-code editor has a bug resulting in this 404 error being returned. I will create a ticket to get this resolved.

    That being said, there is a workaround you can use to get moving. Here are the steps:

    1. Find the title of your workflows start shape, by default this is "Start {workflowName}"

    2. Open the Json editor for your manifest.json file in the pro-code editor

    3. Edit the "startName" property on your workflow mapping to be equal to the title for your workflows start
    shape

    4. Finally, save the manifest.json file to refresh the app preview so you can start your app!

    Please let me know if this doesn't work for you and we can troubleshoot further.

  • DanHendriksen
    DanHendriksen Domo Employee

    Okay, I see you have your code here.

    For me when I'm learning, I start super simple. Remove all the required start parameters from the workflow and see that you can successfully start the workflow without the start parameters. Isolate where the issue might be occurring.

    It would be helpful for me, if you could share the entire app code. Then I can do some testing on my side.

  • jaden.hoenes
    jaden.hoenes Domo Employee
    edited November 22

    Here is the app code I am using for reference

    // Index.html
    <html>
        <head>
            <link rel="stylesheet" href="app.css">
        </head>
        <body>
            <h1>hello_world</h1>
            <!-- domo.js optional utils -->
            <script src="https://unpkg.com/ryuu.js"></script>
            <script src="app.js"></script>
        </body>
    </html>
    
    // app.js
    domo.post('/domo/workflow/v1/models/myWorkflow/start', { myInput: {name:"bob"} })
        .then(function(alias){
        console.log("alias", alias);
    });
    

    You can see my manifest.json file in the screenshot above, but that's all there is to it!

  • Ah ha! That was it. Changing the startName in the manifest did indeed fix the issue. Workflow started up correctly after changing it.

    Thanks both of you for the help!