Skip to main content
Nintex Community Menu Bar
Question

How to add a button to call drawloop in skuid

  • July 9, 2024
  • 8 replies
  • 36 views

Forum|alt.badge.img+3

I am new to Skuid. I have added this Javascript Snippet to create a custom button. The onclick function of the button should call the drawloop ddp. I want to add this custom component in a tab. I cannot see the custom button… What might be the problem? Here is the Javascript snippet that I created. Thanks for your help.

skuid.componentType.register(‘GetContract’,function(element){

var btn = jQuery(‘ Create Contract’).button()
.on(‘click’, function(){
//instantiate a model using “Applications model”
var appModel = skuid.model.getModel(‘applicationYod’);
//Get the first record from our model
var appRow = appModel.data[0];

    //Call Drawloop
    var url = "/apex/loop__looplus?eid={{Id}}&sessionId={{$Api.Session_Id}}&autorun=true";
    var merges = skuid.$('<div>').append(appModel.mergeRow(appRow,url));
    window.open(merges.text());
});
element.append(btn);

});

This topic has been closed for replies.

8 replies

Forum|alt.badge.img+18

Namrata,

This should help: https://community.skuid.com/t/mass-action-inline-javascript-on-related-list-for-drawlo…

If you want, instead of building a custom component, you can just add a button to a pagetitle component and run an inline skuid javascript snippet from the button.


Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

Yup, put your code in a snippet rather than in a custom button.  The snippet can be in a static resource for maximal reuse across a number of skuid pages.  Then a button on your Skuid page can trigger the snippet. 


Forum|alt.badge.img+3
  • Author
  • July 9, 2024

Thanks for the help…I just tried to put use Page Title component and added a button which has action type as Custom: Run Skuid Snippet. But when I click on the button nothing happens. I expect the DDP screen to be displayed when I click on the button… 



Forum|alt.badge.img+3
  • Author
  • July 9, 2024

I changed the above code to this… Any problem with the code?

//instantiate a model using “Applications”
var appModel = skuid.model.getModel(‘applicationYod’);
//Get the first record from our model
var appRow = appModel.data[0];

    //Call Drawloop

    var url = "/apex/loop__looplus?eid={{Id}}&amp;sessionId={{$Api.Session_Id}}&amp;autorun=true";
    var merges = skuid.$('<div>').append(appModel.mergeRow(appRow,url));
    window.open(merges.text());

Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

Where is your snippett?  For testing add it to your skuid page as an “Inline Snippet”   Give it a name.  Add that name into the button definition properties. 


Forum|alt.badge.img+8

Just another approach here (and not necessarily the right one) but we managed this by building a standard salesforce button (as per the standard drawloop syntax to pass parameters in the button)…

and then deploying that button in Skuid using the ‘Custom SF Button/Link’ option in a Page Title component - see screenshot attached.


Forum|alt.badge.img+3
  • Author
  • July 9, 2024

Thank you all for your suggestions. Greg, your approach was the quickest and easiest to implement. I also tried the Snippet option. It worked in the morning. But then I added a file upload component and it stopped working. So adding the salesforce button and accessing that thru Skuid was very helpful…

Thanks Again.


Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

Namrata - I’m glad you got things working.