The Basics

The standard process embed code generated by the portal (see Quick Start) will embed a form that starts the process. Users will be required to log in if they do not have an open Integrify session. Once the form is submitted, an alert is triggered with the text "Your request has been submitted"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
            <div id="integrifyWidget" style="height:500px; width:800px;"></div>
            <script language="javascript" src="https://widgetdemo.integrify.com/integrify/integration/loader.js"></script>
            <script language="javascript">
                var options = {}
                options.processSid = 'a2acae5b-0934-4ff9-8259-ba9da5facb8a';
                options.theme = 'mono-green';
                options.container = 'integrifyWidget';
                var processForm = IntegrifyEmbedder.embedStartProcessForm(options, function(err,response){
                    if (!err) {
                        //console.log(response);
                        alert('Your request has been submitted');
                    }
                });
            </script>
          


A quick change to the code will allow you to handle a successful submit however you wish. The snip below would redirect the user to another page once the form is submitted
1
2
3
4
5
6
7
 
            var processForm = IntegrifyEmbedder.embedStartProcessForm(options, function(err,response){
                   if (!err) {
                       //console.log(response);
                       location.href = "http://mysite.com/myconfirmationpage.html"
                   }
            });
          


You can also check to see if the requester has follow-on tasks before providing feedback. This will allow the next task to load.
1
2
3
4
5
6
7
8
9
 
            var processForm = IntegrifyEmbedder.embedStartProcessForm(options, function(err,response){
                if (!err) {
                    //console.log(response);
                    if (response.next_tasks.length === 0) {
                        location.href = "http://mysite.com/myconfirmationpage.html"
                    }
                }
            });
          


Advanced Options

Setting the widget to run as the built-in Guest user account. Make sure the Guest User account has Run permissions for the process and that the AllowGuest setting in System Settings/System Configuration Settings is set to "yes."
1
2
3
4
5
6
7
8
9
10
11
 
            ...
            options.guest = "MyInstanceID"; //this would match the name of your license file or the InstanceID provided to you by Integrify
            var processForm = IntegrifyEmbedder.embedStartProcessForm(options, function(err,response){
                if (!err) {
                    //console.log(response);
                    if (response.next_tasks.length === 0) {
                        location.href = "http://mysite.com/myconfirmationpage.html"
                    }
                }
            });
          


The widget API exposes events that you can tap into with your code to do things like populate a form
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
            var processForm = IntegrifyEmbedder.embedStartProcessForm(options, function(err,response){
                if (!err) {
                    location.href="/myconfirmationpage.html";
                }
            });
            IntegrifyEmbedder.control('integrifyWidget',{
            selector:'formtaskpage',
            event:'render',
            handler: function(rtCmp) {
                var container = rtCmp.up('task_runtimecontainer');
                
                    function setValues() {
                    //simple check if html is rendered, if not defer the recursive call
                        if (rtCmp.fields) {
                            //fill the fields by their Qustion ID (i.e.Q4425 - see the HTML Source in the Form Editor to verify)
                            rtCmp.fields.get("Q4425").value = '10000';
                            rtCmp.fields.get("Q4424").setValue('Yes'); //use .setValue for select lists
                            
                        } else {
                            setTimeout(setValues, 500);
                        }
                        
                }
                
                    setValues();
                }
            });