Can I destroy and then create a pop-up via snippet?

edited January 27, 2017 in Questions
I have a pop-up that creates a case.  When I save the case record I'd like to give the user the option to create a related task.  If they opt-in to creating a task after creating the case I like the case pop-up to go away and then a new pop-up to appear with a task creation page.

Can someone drop me the javascript code to render a new pop-up?

Thanks!

Comments

  • edited December 18, 2014
    Destroying a snippet is pretty easy with this line:

    skuid.$('.ui-dialog-content').dialog('close');

    Creating one is a lot more complex. Here is an example of a popup created using JS. You basically have to spell out the XML...

    var params = arguments[0],   $ = skuid.$,
       list = params.list,
       model = params.model,
       $xml = skuid.utils.makeXMLDoc;

    var popupXMLString = 

        '<popup width="50%" title="Error">'
            + '<components>'
                + '<pagetitle model="Opportunity">'
                    + '<maintitle>' + 'An error occurred.' + '</maintitle>'
                    + '<actions>'
                        //+ '<action type="custom" snippet="FinishCaseEscalation" label="Complete Escalation" icon="ui-silk-accept"/>'
                    + '</actions>'
                +'</pagetitle>'
                + '<basicfieldeditor model="Opportunity" mode="edit" showsavecancel="false">'
                    + '<columns>'
                        + '<column width="100%">'
                            + '<sections>'
                                + '<section title="Escalation Reason">'
                                    + '<fields>'
                                        + '<field id="CommentBody" required="true"/>'
                                    + '</fields>'
                                + '</section>'
                            + '</sections>'
                        + '</column>'
                    + '</columns>'
                + '</basicfieldeditor>'
            + '</components>'
        + '</popup>';

    var popupXML = $xml(popupXMLString);

    var context = {};

    var popup = skuid.utils.createPopupFromPopupXML(popupXML, context);
  • edited January 27, 2017
    This looks good!  Thanks Moshe!
  • edited July 28, 2014
    Thanks Moshe!

    can i call one more snippet through this...

          //+ '<action type="custom" snippet="FinishCaseEscalation" label="Complete Escalation" icon="ui-silk-accept"/>' 


  • edited December 18, 2014
    It looks like that line has a snippet call inside it " snippet="FinishCaseEscalation" ". If you have a snippet with that name that would probably work. Or you might have to declare the snippet in the XML like:

    <javascript>         <jsitem location="inlinesnippet" name="ContractRequest" cachelocation="false" url="">var $ = skuid.$; ETC...


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!