- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi all,
I have requirement where request form to be created for announcement submission in employee center.
I have created a record producer for "announcement" table and I have mapped all the field except one field as shown in the screenshot.
Can anyone help me to map that field where when user selects the portal it should map to field in the announcement as per the attached screenshots.
Thanks in advance
@Ankur Bawiskar @Amit Gujarathi @AndersBGS
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
in your record producer script you need to insert record into this table "m2m_announcement_portal" to map the announcement with Portal.
I assume your Portal variable refers to table "sp_portal"
Use this record producer script
var rec = new GlideRecord('m2m_announcement_portal');
rec.initialize();
rec.announcement = current.sys_id;
rec.sp_portal = producer.portalVariableName; // give your portal variable name here
rec.insert();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
in your record producer script you need to insert record into this table "m2m_announcement_portal" to map the announcement with Portal.
I assume your Portal variable refers to table "sp_portal"
Use this record producer script
var rec = new GlideRecord('m2m_announcement_portal');
rec.initialize();
rec.announcement = current.sys_id;
rec.sp_portal = producer.portalVariableName; // give your portal variable name here
rec.insert();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hi @dev_S ,
script :
function clicksend() {
var dialog = new GlideDialogWindow("sch");
dialog.setTitle("1st_page");
//dialog.removeCloseDecoration();//ruchi.g.kumari_121142020 : added to remove x icon from top right corner of the ui page
dialog.setSize(750, 300);
dialog.render();
}
gs.addInfoMessage("Test_Send_email_by_Deb");
1st ui page:
html part:
<form>
<div>
<label for="site-search">Search the word:</label>
<input type="search" id="mySearch" name="q"
placeholder="Search the site..." size="30"/>
<button type="button" onclick="searches()">Search</button>
<button type="button" onclick="ruchi()">2nd page</button>
<button type="button" onclick="cancel()">Cancel</button>
</div>
</form>
client script part:
function searches(){
var short_text = g_form.getValue('mySearch');
var sita = g_form.getValue('short_description');
var ram = sita.search(short_text) > -1;
var regExp = new RegExp(short_text, "gi");
var x = (sita.match(regExp) || []).length;
var s1=sita.toString();
var regExp = new RegExp(short_text, "gi");
var s2 = s1.replace(regExp,'*');
alert("All replaced. The count "+ ' '+(x));
g_form.setValue("short_description",s2);;
GlideDialogWindow.get().destroy();
return false;
}
function ruchi(){
var dialog = new GlideDialogWindow('search');
dialog.setTitle("2nd");
dialog.setWidth(400,230);
dialog.render();
}
function cancel(){
//Close the dialog window
GlideDialogWindow.get().destroy();
return false;
}
--------------------------------------------------------------------------------
2nd ui page:
html part:
<form>
<div>
<label for="site-search"><h2>Search the word :<span style ="padding-left:10px;"></span></h2></label>
<input id="mySearch"
placeholder="Search the word..." size="50" />
<g:evaluate var="jvar_num"
expression="RP.getWindowProperties().get('num')" />
<h4><button type="button" onclick="searchReplace()">Search</button>
<button type="button" onclick="deb()">submit</button>
<button type="button" onclick="cancel()">Cancel</button></h4>
</div>
</form>
client script part:
function searchReplace()
{
var stext = g_form.getValue('mySearch');
var numb = g_form.getValue('number');
alert("Number " + (numb));
alert("Text " + (stext));
var ga = new GlideAjax('ParentChildSync');
ga.addParam('sysparm_name','scrubText');
ga.addParam('sysparm_number',numb);
ga.addParam('sysparm_stext',stext);
ga.getXML(callback);
}
function callback(response) {
var answer = response.responseXML.documentElement.getAttribute("updcount");
alert("Replaced count " + (answer));
GlideDialogWindow.get().destroy();
return false;
}
function cancel(){
//Close the dialog window
GlideDialogWindow.get().destroy();
//return false;
}
function deb(){
gsftSubmit(null, g_form.getFormElement(), 'click_send');// it will click ui action Send_deb button
}
Last part remaining to complete : by clicking submit button it will click the ui action button Send_deb and load the 1st page freshly
If my response helped please mark it correct
thanks,
Abin