Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

Get an input from an html page that is shown when a user click a ribbon button

Posted on by 5

Hello,

Some background of the problem:


-I have an entity called "booking contract"

-I want to create a ribbon button that renew the contract.

-By renewing a contract a new contract record should be created with the exact same information but not the same "end date" (that is a field)  and the start date of the new record will be automaticly set so it is the same as the end date of the contract being renewed.

-I want the user to input the new "end date" when he clicks on the "renew" button.

Basicly i want to display a form with just the end date to receive the user input when he clicks the renew button and use that end date and the information from the contract being renewed to create a new contract

Do you have any suggestions on how to do this?

There are 2 methods that I think could solve this problem:

-Create a quickcreate form and displaying it on button click. The form would have all the fields filled and invisible and the end date empty and visible. Then I would use information on that form to create the new contract.

-Create an HTML page with a form to input the new end date and get the value on the js script, but I have no idea how to get the value. I already searched but did not understand.

I never created a js script and this will be my first but I have some minor experience with plugins and custom workflows.

  • roger40 Profile Picture
    roger40 5 on at
    RE: Get an input from an html page that is shown when a user click a ribbon button

    Yes. it was hard and had to try alot of different stuff.

    what worked was installing crm sdk to get jquery.min file, create a web resource for it and upload that jquery file then in the HTML link to that web resource.

    Then I was able to close the HTML page with a custom button and able to get to the callback function of the navigate method in js script when HTML is closed

    and retrieve data in localstore set by the HTML.

    It not that it is too hard but the lack of documentation its crazy for such a simple thing.

  • MikeC282 Profile Picture
    MikeC282 2,068 on at
    RE: Get an input from an html page that is shown when a user click a ribbon button

    That's good to hear. We're you able to get the submitted form inputs from the webresource from session storage?

  • roger40 Profile Picture
    roger40 5 on at
    RE: Get an input from an html page that is shown when a user click a ribbon button

    PS: was able to solve this. i had to put the HTML code in the "source" tab and I was in rich editor tab, that was not specified anywhere on the internet

    Hello, ty for your help.

    I can open the HTML web resource but the page displays raw text instead of formated HTML.

    The code I'm using to open it:

    var navigationOptions = {

    target: 2,

    width: 400, 

    height: 300, 

    position: 2 

    };

    var pageInput = {

    pageType: 'webresource',

    webresourceName: 'Publisherprefix_Name of web resource'

    };

    Xrm.Navigation.navigateTo(pageInput, navigationOptions);

  • Suggested answer
    MikeC282 Profile Picture
    MikeC282 2,068 on at
    RE: Get an input from an html page that is shown when a user click a ribbon button

    Hey bud

    If you're gonna pop out a custom HTML webresource with a form in it and want to pass the form selection data back. There's no out of the box way to do it but you can store the form inputs in Windows session storage and then retrieve it after the form closes.

    developer.mozilla.org/.../sessionStorage

    So create a event listener and grab your form input values and store it in session storage and then retrieve it when you need it.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans