Thursday, December 6, 2018

Problems to call web services from Nintex form for O365

We have tried to call web services from Nintex form for O365. We have only one button that will call weather.com web service and try to get the result back so we could process. Here are few configurations we have tried but none of them are working. If you have any idea how to make this works, the Nintex form can be used extensively in SharePoint online and O365.

1. Nintex web request control seems the west way. Try to use enterprise web request control but it does not seem to be available for Nintex form for O365. It might be only available for on-premises Nintex version, can you please confirm?


The Call http request is only available in Nintex worklfow not form. Is this correct?

2. Tried to use JavaScript action button to call custom javascript as in the following screenshots. Here are two questions.






a. The JavaScript button is only available in classic form, when this will be available in modem form?

b. Tried to configure the javaScript like posted in this blog and the similar script, the web service call always fail into the error. Do we have suggestion how to configure the web service call and retrieve the return values?

The script is like below.

function getHarryListTitle(){

alert("Before Ajax call");

NWF$.ajax({
            url: "https://api.weather.gov/points/39.7456,-97.0892",
            data: "", 
            contentType: "application/json; charset=utf-8", 
            type: "GET",
            success: function (data) {
               alert("After Ajax call");
               alert(data);
            },
            error: function (x, y, z) {
               alert("Error Ajax call");   // Always fails here!
               alert(x.responseText +"  " +x.status);
            }
        });



}

Please let us know if you have any suggestions.

Wednesday, December 5, 2018

How to set up Nintex workflow to read configuration values

When we use O365 Nintex workflow variables, it's a good practice to configure them in external system like SharePoint list to make them flexible and configurable. Here are two different ways to configure using SharePoint list as look-up.

We have a configuration like called "HarryConfigDev" with two columns "Title" and "Value". Two configure entries with two titles as "EndPoint1" and "EndPoint2". They will point to two different web site. This will be used in method #1 to retrieve the configuration in "Value" column.


We also have a SharePoint list named as "HarryDev" with one column named "EndPoint". This will be used in method #2 to retrieve "HarryConfigDev" configuration in "Value" column when the list column "EndPoint" value equals "Title" of the configuration.



Here is the configuration in Nintext workflow set variables for method #1. Please note the value to look up is harded as "EndPoint1"



Here is the configuration in Nintext workflow set variables for method #2. Please note the value is dynamically getting from the list field "EndPoint".


The logs will should the result from both methods.


Based on the different situation, you might need to use on of these methods.


Monday, December 3, 2018

Detailed procedure Nintex workflow integrates with Azure function


Nintex and Azure functions are heavily used in my new company for O365. There is a need to integrate Nintex workflow with Azure functions. The first task for me is to configure how the Nintex workflow to call Azure function and retrieve the returns from the function.  Here are details I would like to keep as my reference.

1. The first step is to set up a SharePoint online list that could test the Nintex workflow. The list is out of box simple list with default "Title" field.

2. Second step is to set up a simple Azure function as indicated as in this blog. You could use visual studio to create a default Azure function and deploy to Azure as described here. Then you need to identify the endpoint that your Nintex workflow can call.

In your new function, click </> Get function URL at the top right, select default (Function key), and then click Copy. 



The endpoint will looks like this:

Since this is simple function and will only take one input query key/value as name as "Bob" to display "Hello Bob", the key and value will be passed in the URL.

3. The third is to set up a Nintex workflow. Here are details.
a. Set up a Nintex workflow variables as in the screenshot.


b. Set the variables through Build Dictionary action as in the screenshot.

c. Add workflow action Call Http Web Services to call Azure function using the function endpoint as described before. Please note the URL is hard coded and we will discuss how to get it from configuration list.

d. Add Log to History List action to debug the function.


After save and publish, the overall workflow will look like this:

3. Run the workflow from the list item and verify the workflow history.

You can see the response status is "OK" and the response result it "Hello Bob".

Now you can integrate Azure function from Nintex workflow. The next steps will to create Azure functions that will return other format like xml or jason. Then use Nintex workflow to retrieve the return result and process the business logic. This seems like similar as text returns.