- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2013 03:23 AM
Hi All,
I have added an embedded list to a form. When user want to add any record in that related table, he needs to go through the Insert New Row and edit the entered record. In the normal related list, we can see New button. I searched in embedded list control and there is no option to set New or add button unlike in related list control.
I can see the Add button from the attachment of the below forum post.
Embedded Lists
Is there any setting that I need to modify to see the Add button in the embedded list?
Regards,
Radhika
Solved! Go to Solution.
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 02:37 AM
Here is the UI macro code that we have created. I have used the sample code from SNC guru to open the popup and added little bit of code to pass the values to the dialog form
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="add_${jvar_guid}:${ref}"/>
<img border="0" src="add.gifx" title="${gs.getMessage('Add')}" alt="${gs.getMessage('Add')}" onclick="addEditUserPopopt('${ref}')"/>
<script>
//OnClick function for UI macro
function addEditUserPopopt(reference){
var v = gel('sys_uniqueValue').value;
if(v == ''){
var dialog = new GlideDialogForm('Add, your table name',saveOriginalForm);
dialog.setSysID('-1'); //Pass in -1 to create a new record
}
else{
var dialog = new GlideDialogForm('Add ', 'your table name',saveOriginalForm);
dialog.setSysID(-1); //Pass in reference sys_id to edit record
}
dialog.addParm('sysparm_view', 'default'); //Specify a form view
dialog.addParm('sysparm_form_only', 'true'); //Remove related lists
//Callback function executed from dialog submit
dialog.setLoadCallback(function(iframeDoc) {
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
var interval;
var count = 0;
interval = setInterval(function() {
try {
if (dialogFrame.g_form) {
dialogFrame.g_form.setValue('related field', v);
clearInterval(interval);
dialogFrame = null;
} else if (count > 50) {
clearInterval(interval);
dialogFrame = null;
}
}catch (e) {
clearInterval(interval);
dialogFrame = null;
}
count++;
}, 200);
});
dialog.render(); //Open the dialog
}
function saveOriginalForm(action){
g_form.save();
}
</script>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2014 11:58 AM
I ended up just using a related list instead of an embedded one. I then removed breadcrumbs/filters from all but admins, and took away the new buttons elsewhere they could access the items from the related list (so that they were forced to use the related list to create a new item).
This worked well for me, and looks almost like an embedded list.
~Lindsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2014 03:21 PM
Hi Radhika Aluru,
I am trying to do the same. Can you give me an example of UI Macro?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 02:37 AM
Here is the UI macro code that we have created. I have used the sample code from SNC guru to open the popup and added little bit of code to pass the values to the dialog form
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="add_${jvar_guid}:${ref}"/>
<img border="0" src="add.gifx" title="${gs.getMessage('Add')}" alt="${gs.getMessage('Add')}" onclick="addEditUserPopopt('${ref}')"/>
<script>
//OnClick function for UI macro
function addEditUserPopopt(reference){
var v = gel('sys_uniqueValue').value;
if(v == ''){
var dialog = new GlideDialogForm('Add, your table name',saveOriginalForm);
dialog.setSysID('-1'); //Pass in -1 to create a new record
}
else{
var dialog = new GlideDialogForm('Add ', 'your table name',saveOriginalForm);
dialog.setSysID(-1); //Pass in reference sys_id to edit record
}
dialog.addParm('sysparm_view', 'default'); //Specify a form view
dialog.addParm('sysparm_form_only', 'true'); //Remove related lists
//Callback function executed from dialog submit
dialog.setLoadCallback(function(iframeDoc) {
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
var interval;
var count = 0;
interval = setInterval(function() {
try {
if (dialogFrame.g_form) {
dialogFrame.g_form.setValue('related field', v);
clearInterval(interval);
dialogFrame = null;
} else if (count > 50) {
clearInterval(interval);
dialogFrame = null;
}
}catch (e) {
clearInterval(interval);
dialogFrame = null;
}
count++;
}, 200);
});
dialog.render(); //Open the dialog
}
function saveOriginalForm(action){
g_form.save();
}
</script>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2016 01:39 PM
can u show us the output image for this work please if you can .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2017 07:02 AM