Skip to main content

SurveyJS and PowerApps Portals [Part 4]

To call Web API we will need to call webapi.safeAjax function which accepts one argument ajaxOptions which is a standard object with properties for ajax request.

Please refer the Microsoft documentation


In this snippet, we are referring all the libraries required for SurveyJS to render the data and store responses provided by the user in an object (which we use to store in d365 CE tables).

We have created a div element to render the form on the portal and another div element to show a customized message on the portal.



In this snippet - on document.ready, we are calling a function getSurveyData() to render the data on to the portal, initializing the methods (out of the box in SurveyJS) to capture the data on Complete button click and Next page button click on the form.

To render the data, we are making a Web API call to the Dynamics from PowerApps Portals and passing that JSON object into Survey object.

Refer SurveyJS documentation for more details.


In this snippet - we have created method to store data back into Dynamics using Portals Web API on Next Page button click and Complete button click. We are using an argument "actionType" to identify the action performed by the user on the portal.

This is completely depending on the requirement.


Comments

Popular posts from this blog

Validate an email input in a Canvas Application | PowerApps

Validate an email input in a Canvas Application | PowerApps In this post let us see, how to Validate an email input in a Canvas Application UI Validations helps us to ensure, valid data is received from the End User to complete an operation helps end user to provide right information the validation action depends on the type of the input control for Text Input Control - mostly we go with "OnChange" for check box control - "OnCheck and On uncheck" for Drop Down and Combo Box Controls - "OnChange" or "OnSelect" etc., Now, let us see how can we validate an email input, a phone number input and a name input. How to validate an email input value is valid? We can leverage "Regex" (Regular Expressions) to valid user inputs. Let us consider the Email Input Control Name as -  txtEmail.Text. OnChange of this Control let us i...

Success confirmation on a record submission - Canvas Application

In this post let us see, how to show a successfully submitted record's data back on to the form, as a confirmation. Take two screens  Home Screen Success Screen On Home Screen: Take a Form Control on the Home Screen and map it to respective entity. In this post we are mapping it to Registrations entity. Take a Button Control and input the below expression, to create records into Registrations Entity. SubmitForm( frmRegistration ) Now, let us implement how to redirect the user to Success Message screen to successful record submission. In order to achieve this, we are going to make use of one of the Form Control's properties - OnSuccess. So, OnSuccess we are going to implement Success Screen navigation as below Navigate(' Success Screen ')   Success Screen Take a label to show - success message, as below "Registration was successful. Registration Id: " & frmRegistration .LastSubmit.'Registration Number' LastSubmit  property of a From Control helps u...

Convert an array to string in Power Automate (MS Flows)

converting an array value to a string using Power Automate out of the box function. " how to convert an array to string " in MS Flows. Basically, we can use "split" function to convert an array into string but we may end up having extra comma to the last value. To remove that we have to use another expression which checks for the string length and removes the last character [ substring(variables('varListOfRequestIDs'),0,sub(length(variables('varListOfRequestIDs')),1)) ]. To avoid this round about process rocess, we can leverage Power Automate's simple and out of the box function -  join Here is an to show how can we convert an array to string. for instance let's consider, we have an array [796759,933436,926050,1388108,762632,764554]. But as per the requirement, we need to convert it to string and send that value as 796759,933436,926050,1388108,762632,764554.  varListOfRequestIDs = [796759,933436,926050,1388108,762632,764554] varStringListOfRe...