How to add a button to call drawloop in skuid

edited December 4, 2017 in Questions
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('<button> Create Contract</button>').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);
});

Comments

  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    Namrata,

    This should help: https://community.skuidify.com/skuid/topics/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.
  • Rob HatchRob Hatch 💎💎💎
    edited September 1, 2016
    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. 
  • edited September 1, 2015
    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.. 


  • edited September 1, 2015
    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}}&sessionId={{$Api.Session_Id}}&autorun=true";
            var merges = skuid.$('<div>').append(appModel.mergeRow(appRow,url));
            window.open(merges.text());
  • Rob HatchRob Hatch 💎💎💎
    edited September 1, 2016
    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. 
  • edited December 4, 2017
    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.

    image


  • edited September 1, 2016
    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.
  • Rob HatchRob Hatch 💎💎💎
    edited September 1, 2016
    Namrata - I'm glad you got things working. 
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!