Need to call widget from another widget.

Allu Gopal1
Giga Guru

Hi,

I am trying to get the widget from another widget. I have tried using the below code, but it is getting as empty only. "sc-variable-summarizer" this is OOB so i dont want to disturb this code.

HTML:

<div>
  <div>
<sp-widget widget="data.details_widget"></sp-widget>
  </div>
</div>

Server script: 

data.details_widget = $sp.getWidget("sc-variable-summarizer", {
        sysId: taskGr.sys_id,
        tableName: getTaskRecord()
    });

I can see that widget is getting called but the variables are not coming for the current record. I called the widget widget is in green color.

find_real_file.png

Please help me on this. Thanks in Advance.

Thanks and Regards,

Allu Gopal.

7 REPLIES 7

Community Alums
Not applicable

Hi @Allu Gopal ,

The most easy example is the form widget, where the server script calls the $sp.getWidget to pull the conversation widget and then use it in HTML to place the widget inside the form widget for ex <sp-widget widget="fm.widgetInstance"/>

 

find_real_file.png

Refer to this video :https://www.youtube.com/watch?v=VtSinbDRdcw

Also, Check below for solutions to embed widget :Embedded widgets

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Hi Sandeep,

Thanks for the reply but i have tried the similar way of passing the variables to that variable summerizer widget.

data.details_widget = $sp.getWidget("sc-variable-summarizer", {
        sysId: taskGr.sys_id,
        tableName: getTaskRecord()
    });

But the data is not getting.

Regards,

Allu Gopal.

 

How to pass these two variable data into the another widget.

widget 1:

data.details_widget = $sp.getWidget("hrc_variable_summarizer", {tabname: getTaskRecord(), 
                                                                        sys_id: taskGr.sys_id});
     gs.addInfoMessage(getTaskRecord());
    gs.addInfoMessage(taskGr.sys_id);

widget 2:

var tabname;
    var sys_id;
    //var tabname= "sn_hr_core_sbs_service_request";
    gs.addInfoMessage(tabname);
    //var sys_id = "15d768ea1b8911d4d849206e3b4bcbdd";
    gs.addInfoMessage(sys_id);
    var record = sn_std_tkt_api.TicketConfig.getTicketRecord(tabname, sys_id);

 

Please help me on this.

Thanks and Regards,

Allu Gopal.

 

Hi Sandeep,

 Any findings or solution for this ?

Thanks and Regards,

Allu Gopal.