SP: Creating a new record in a widget using widget-form with details passed in
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2023 11:51 AM
I'm having trouble creating a new record in the Service Portal. I've added a button to a widget that, when clicked, calls this:
Client script
c.newButtonClicked = function(widgetId, widgetInput) {
var url = top.location.href;
var submittalId = new URLSearchParams(url).get("sys_id");
widgetInput.submittal_request = submittalId;
spModal.open({
widget: widgetId,
widgetInput: widgetInput,
buttons: [],
shared: {scope: $scope}
}).then(function(){
action.setRedirectURL(targetPageID);
})
}
is called in the HTML with this:
HTML
<div ng-if="c.options.hide_new == 'false'">
<button class="new-record" ng-click="c.newButtonClicked('widget-form', {'table':options.table,'sys_id':'-1'})">New</button>
</div>
I'd like to fill in the "submittal_request" reference field on the new Comment object with the submittalId I pass in to the widgetInput object. Is there some way that I can make the base Form do this, or do I need to clone it?
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2023 01:54 PM
The last response in this thread may help you.
Please mark this response as correct or helpful if it assisted you with your question.