cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shahriat
Helper I
Helper I

Web resource doesn't work in webform step

I have created a web form with 3 steps based on account entity's tabs.

 

In the first step I have summary tab, in the second step I have a custom bing map by which I will pick latitude and longitude from the map and will add in account entity's latitude and longitude. And in the 3rd step I have details tab.

 

In the second step I have a custom tab based on web resource which doesn't work in web form. 

 

Has any workaround how can I make second step workable?

 

If web resource doesn't work can I add page template? I have seen page can be added with redirect option but I don't need redirect. 

 

And also how can I set latitude and longitude for account entity using liquid syntax and save on the second step?

 

Any help please.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @shahriat,

No, there isn't a liquid object for the webform steps that I'm aware of.

You could consider setting a global variable in the Custom JavaScript section of the Web Form Step and reference that in the Web Template. E.g.

// in Custom JavaScript of Step
$(document).ready(function () {
  window.customCode.showButton();
});

// in Web Template
<script src="text/javascript">
  $(document).ready(function () {
    window.customCode = window.customCode || {};
    window.customCode.showButton = function () {
      // create & show button
    };
  });
</script>

View solution in original post

4 REPLIES 4
justinburch
Microsoft
Microsoft

Hi @shahriat,

Why doesn't the web resource work? Is it an issue of the iframe itself? If so, you could attempt to to use the "Render Web Resources Inline" option to have the code placed directly into the HTML instead of an iframe.

justinburch_0-1601573463383.png

As for the question of the Page Template - your Page Template is what defines the layout of the Page, which hosts the Web Form - so no, you can't embed a Page Template into a Web Form Step. Instead, the Web Form Step is, in a way, embedded into a Page Template. You could add code to your Page Template, but you likely need a way to identify which step has just been loaded in order to show from the Page Template at the right time. It's probably easier to get the Web Resource working, as long as the Web Resource isn't trying to use the standard API or any other data inaccessible in the Portal.

Additionally, Liquid cannot be used to make an update. Liquid is a pre-rendering template language only. If the data exists already, you can retrieve it using liquid and put it in input fields to grab with JS, but if it's data you're entering in Step 2 in order to save to the Account entity itself, you'll have to continue your current path.

Example of storing the latitude/longitude if it exists on load of step 2:

{% assign acct = entities.account[params.id] %}
<input type="hidden" id="lat" value="{{ acct.address1_latitude }}">
<input type="hidden" id="long" value="{{ acct.address1_longitude }}">
<script>
  $(document).ready(function () {
    window.mapCoords = window.mapCoords || {};
    window.mapCoords.lat = $("#lat").val();
    window.mapCoords.long = $("#long").val();
  });
</script>

You would now have a global object to retrieve the hidden lat/long from.

Hi Justin,

Thank you for your reply.

 

Since template can't be embedded inside webform step so is it possible to detect steps inside template or page if I embed webform there.

 

I have 4 steps. In my step 3 I want to add html code which will render the map. Now I want to detect step 3 so that I can integrate my map's html code under that step. For example:

{% webform name: 'My Web Form' %}

{{if step ==3 }}

<map></map>

{{endif}}

 

It seems that I can detect step from query string through the url but I don't want to make hard condition with hard code step GUID id.  Is it possible with liquid code following best practice so that my code can work in any environment? 

 

 

Hi @shahriat,

No, there isn't a liquid object for the webform steps that I'm aware of.

You could consider setting a global variable in the Custom JavaScript section of the Web Form Step and reference that in the Web Template. E.g.

// in Custom JavaScript of Step
$(document).ready(function () {
  window.customCode.showButton();
});

// in Web Template
<script src="text/javascript">
  $(document).ready(function () {
    window.customCode = window.customCode || {};
    window.customCode.showButton = function () {
      // create & show button
    };
  });
</script>

View solution in original post

Hi Justin,

Thanks a lot for your such valuable responses. 

 

I am facing an issue like when I edit any page using Portal Studio Editor instead of Portal Management then if I have any div with id attribute like:

 

<div id="map" class="map"></div>

 

when I save the page the id attribute is being removed and my content saved as:

<div class="map"></div>

 

not sure why id="map" is getting removed. Do you have any idea?

 

"id" need to have in div to load the map.

 

and also how to get the web form step submit button event? I want to add record into my custom entity when submit button is clicked.

 

Thanks.

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Users online (26,701)