How to Stop updating State field when I click on Draft button at Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday - last edited Wednesday
Hi,
We have two buttons on Records
Ui Actions : Draft (v_draft) this button does not apper at portal ,
Portal : "Save Draft"
Desktop side we have one
OnSubmit Client script OnSubmit Client script
if(g_form.getActionName()!='v_draft')
{
g_form.setValue('state','Progress') ;
return true;
}else{
return false;
}Ui Action : Draft(v_draft)
Client =true
form=true
function unmadate(){
g_form.setMandatory('customer' false);
gsftSubmit(null,g_form.getFormElement(),'v_draft');
}
if(typeof window=='undefined'){
saverecord();
function saverecord(){
current.update();
action.setRedirectURL(current);
}
Portal side : When we click on 'Save Draft" button record has to save record , but should not change state value. but here State value change to "Progress". this ObSubmit triggering . how to stop controlling it.
HTML :
<button id="save_draft" ng-click="validateAndSubmit()" class="btn btn-primary"> Save Draft </button>
Client Controller :
$scope.getPrimaryAction=function()
{
var primaryActions=$scope.data.f._ui_actions.filter(function(Action)
{
if($sco[pe.data.table!='account_benefit'){
if($scope.data.table!=6) return'';
else
return action.primary
});
return (primaryActions.length)? primaryActions[0]:null;
}
$scope.validateAndSubmit = function()
{
var primaryAction = $scope.getPrimaryAction();
if(primaryAction)
{
$scope.triggerUIAction(primaryAction)
}
$scope.triggerUIAction=function(action)
{
$scope.$evalAsync(function (){
if(g_form)
{
$scope.submittiing=true;
if(!g_form.submit(action.action_name||action.sys_id)){
$scope.submitting=false;
}
}
var primaryAction = $scope.getPrimaryAction(); returning OOB UI action "Update" button details in object format
[{}] - SysID, name, primary
Please help me how to stop updating State field with "Progress". this ObSubmit triggering . how to control it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
It looks like this is happening within the 'Update' UI Action. Which table/records are you clicking on the Draft button? Do you have a UI Action named 'Update' for this table? If you can't change the out of box behaviour to update the State, a workaround would be to add lines to change the State back.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Brad Bowman ,
Thanks for helping me here.
"Update" button is OOB Global table button.
Portal side we don't have that one, but native UI side we have on record.
Every time system considering OOB "Update" button while updating form get's submitted right so Client script running, state value setting to Progress. I want state value in Draft only because portal side I clicked on "Draft" button.
is there any way how to control and achieve it please ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12 hours ago
Hi @Supriya25,
This button is like button on the portal not the UI action button but it is internally triggering primary action for the form. Can you try putting alert in client script and check what action name is coming ? ideally it should come as 'save' so you should apply your condition based on that .
alert(g_form.getActionName()); // Check this value after click of 'Save Draft' on portal;
if(g_form.getActionName()!='') // and apply condition based on above alert put appropriate condition
{
g_form.setValue('state','Progress') ;
return true;
}else{
return false;
}
Please mark this as correct/helpful if this helps you.
Thanks,
Akshay