Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Customized Forms Opening and Saving

I have a couple customized forms that are acting erratic. 



When I create a new form, at times the form creates in New mode other times Edit mode.  If I click new from the list and the form appears in Edit mode, click the 'X' and click new again and it usually creates in New mode.  When the form creates in New mode all the fields are blank as expected.  When it creates but shows Edit mode, the form is populated with data from the form in the first row of the list.  I use the following formula to show the mode:

    frmWorkflow.Mode = FormMode.New, "New",
    frmWorkflow.Mode = FormMode.Edit, "Edit",
    frmWorkflow.Mode = FormMode.View, "View",


Here is the SharePointIntegration OnNew code:

NewForm(frmAuthApproval_1); Navigate(AuthApprovalNew, ScreenTransition.None); Set(varChanges, ""); Set(varStatus, "Draft")


Here is the SharePointIntegration OnEdit code:

EditForm(frmAuthApproval); Navigate(AuthorizationApproval, ScreenTransition.None); Set(varReset, false);
Set(varLogStatus, dcStatus.Default);
Set(varLogDTRequested, Title_DataCard.Default);

Set(varLogRequestor, dcRequestor.Default);
Set(varLogReqManager, dcReqManager.Default);
Set(varLogSysAccess, dcSystemAccess.Default);
Set(varLogSysAuthSpecialist, dcAuthorizationSpecialist.Default);
Set(varLogNewSOD, dcNewSOD.Default);
Set(varLogSODAuthority, dcSODAuthority.Default);
Set(varLogImplementer, dcImplementer.Default);
Set(varLogReqDesc, dcReqDesc.Default);
Set(varLogComments, dcComments.Default);
Set(varLogChangeLog, dcChangeLog.Default)


Here is the SharePointIntegration OnCancel code:



Also, I have buttons on the form that I want the user to click to execute specific code and then trigger the OnSave.  This code worked in the past but no longer works.


Here is the code for one of the buttons the user clicks, it shoud run the code then trigger the OnSave:

Set(varChanges, dcChangeLog.Default);
Set(varStatus, "Pending Mgr Approval");
Set(varChanges, User().FullName & " created SOX Authorization on " & Text(Now(), DateTimeFormat.ShortDate));
UpdateContext({varTickerTape: "Last Action: An email was sent to " & dcReqManager.Update & " requesting manager approval on " & Text(Now(), "[$-en-US]mm/dd/yyyy hh:mm AM/PM")});
UpdateContext({varMgrNotified: "Yes"});


Here is the SharePointIntegration OnSave code:

(!IsBlank(dcChangeLog.Default) And !IsBlank(dcChangeLog.Update)), Set(varLogChangeLog, dcChangeLog.Update),
!IsBlank(dcChangeLog.Update) , Set(varLogChangeLog, dcChangeLog.Update),
!IsBlank(dcChangeLog.Default) , Set(varLogChangeLog, dcChangeLog.Default)
If((dcStatus.Default = "Draft") And (lblMgrNotified.Text = "Yes"),
dcStatus.Update= "Pending Mgr Approval"
Set(varChanges, "");
If((Title_DataCard.Update <> varLogDTRequested) And !IsBlank(varLogDTRequested), Set(varChanges, varChanges & "Date Requested "));

If((dcRequestor.Update <> varLogRequestor) And !IsBlank(varLogRequestor), Set(varChanges, varChanges & "Requestor "));
If((dcReqManager.Update <> varLogReqManager) And !IsBlank(varLogReqManager), Set(varChanges, varChanges & "Requestor's Manager "));
If((dcSystemAccess.Update <> varLogSysAccess) And !IsBlank(varLogSysAccess), Set(varChanges, varChanges & "System Access "));
If((dcAuthorizationSpecialist.Update <> varLogSysAuthSpecialist) And !IsBlank(varLogSysAuthSpecialist), Set(varChanges, varChanges & "Authorization Specialist "));
If((dcNewSOD.Update <> varLogNewSOD) And !IsBlank(varLogNewSOD), Set(varChanges, varChanges & "New SOD "));
If((dcSODAuthority.Update <> varLogSODAuthority) And !IsBlank(varLogSODAuthority), Set(varChanges, varChanges & "SOD Authority "));
If((dcImplementer.Update <> varLogImplementer) And !IsBlank(varLogImplementer), Set(varChanges, varChanges & "Implementer "));
If((dcReqDesc.Update <> varLogReqDesc) And !IsBlank(varLogReqDesc), Set(varChanges, varChanges & "Request Description "));
If((dcComments.Update <> varLogComments) And !IsBlank(varLogComments), Set(varChanges, varChanges & "Comments "));
If(!IsBlank(varChanges), Set(varChanges, User().FullName & ", on " & Text(Now(), DateTimeFormat.ShortDateTime) & " changed " & varChanges));
If(!IsBlank(varChanges), Set(varChanges, varLogChangeLog & Char(10) & varChanges), Set(varChanges, varLogChangeLog));


Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (12,538)