Hello,
Newbie here...
I have a canvas app form that auto populates the Requestor Name and Email on New Form and all that works great.
How do I block it from updating if someone views it or edits it.
In the app I have an OnStart of:
Set(
varUser,
{
myProfile: Office365Users.MyProfileV2(),
directReports: Office365Users.DirectReportsV2(User().Email),
myManager: Office365Users.ManagerV2(User().Email)
}
)
For Requestor Name I have on the DefaultSelectedItems
{
DisplayName:User().FullName,
Claims:"i:0#.f|membership|" & Lower(User().Email),
Email: User().Email,
Picture:""
}
Then on the Data - Default field for Requestor Email I have:
varUser.myProfile.mail
So how do I lock those so then never change after the 1st submit?
Solved! Go to Solution.
Also:
1. Check the Default property of both the DataCardValue and the Data Card. If the DataCardValue one says Parent.Default, then go to the Data Card instead. Adjust it appropriately
If(SharePointForm1.Mode = FormMode.New,WhateverIsThereNowThatsChangingTheValue,ThisItem.ColumnName)
If the above just said ThisItem.ColumnName just ignore the above and go to the next step.
2. Check the Item property of the Form. Look for anything there that might be modifying those record column values and take it out or surround it by a similar If function to only do it when the FormMode is New.
3. Same as #2 above but check the OnVisible of the Screen that the Form is on and look for anything applicable and make appropriate adjustments.
See if it helps @CarrieECalvi
DisplayMode property of both Data Cards
//psuedo-formula - replace FormControl below with actual name of your Form Control
If(FormControl.Mode = FormMode.New,DisplayMode.Edit,DisplayMode.Disabled)
//you can also use DisplayMode.View instead of DisplayMode.Disabled above if you prefer it
Does it work?
Ok maybe I didn't explain the best. I don't want the auto-populated name/email to change after it is submitted. Currently say Jane Doe submitted the form and it auto-populated name/email and she submits. Then say I come in and double click to view the item, well it overrides her name with mine. I don't want that to happen.
This just greys out the field but the stuff still updates with current user. I need Created by to stay always.
Check the Update property of that Data Card and see if something is in there.
If so, wrap it in this:
//psuedo-formula - replace FormControl below with actual name of your Form Control
//replace WhateverAlreadyWasThere below with what was already in there
If(FormControl.Mode = FormMode.New,WhateverAlreadyWasThere,false)
or just simply
//psuedo-formula - replace FormControl below with actual name of your Form Control
//replace WhateverAlreadyWasThere below with what was already in there
If(FormControl.Mode = FormMode.New,WhateverAlreadyWasThere)
Does this resolve the issue?
So if it helps I have the default form name of SharePointForm1 and my data card value is: DataCardValue2 but I don't see anything in my Data Card called Update? Sorry, as I said... newbie here.
Here are the steps I believe you followed, I think the property is not in this Control though
1. In tree view on the left expand the Data Card by clicking the chevron
2. Look for DataCardValueX and select it. Now check if that has the Update property
In the above DataCardValueX the Update property should be missing.
So instead, try these steps below and see if they work better:
1. Click the Data Card itself. Now check if that has the Update property
If needed do this first
1. Click Data Card
2. Click Unlock to change properties under Advanced
Yes, I know how to unlock to change properties 🙂
The combo box, nor the Text Input does not have an Update field on the DataCardValue, only on the DataCard.
So I tried: If(SharePointForm1.Mode = FormMode.New,DataCardValue3,false) on the email Update field but it errors. I am sorry I am not understanding this.
Does this work (i.e. simply omit the argument specifying false)?
If(SharePointForm1.Mode = FormMode.New,DataCardValue3)
If not, put back what was there before, just DataCardValue3 and try the things in my most recent post instead.
Also:
1. Check the Default property of both the DataCardValue and the Data Card. If the DataCardValue one says Parent.Default, then go to the Data Card instead. Adjust it appropriately
If(SharePointForm1.Mode = FormMode.New,WhateverIsThereNowThatsChangingTheValue,ThisItem.ColumnName)
If the above just said ThisItem.ColumnName just ignore the above and go to the next step.
2. Check the Item property of the Form. Look for anything there that might be modifying those record column values and take it out or surround it by a similar If function to only do it when the FormMode is New.
3. Same as #2 above but check the OnVisible of the Screen that the Form is on and look for anything applicable and make appropriate adjustments.
See if it helps @CarrieECalvi
Also see if your answer is already partially contained in your original post.
More specifically:
@CarrieECalvi wrote:For Requestor Name I have on the DefaultSelectedItems
{
DisplayName:User().FullName,
Claims:"i:0#.f|membership|" & Lower(User().Email),
Email: User().Email,
Picture:""
}
Then on the Data - Default field for Requestor Email I have:
varUser.myProfile.mail
So how do I lock those so then never change after the 1st submit?
The answer then is the DefaultSelectedItems and Default need to be surrounded by the If check for the Form Mode being FormMode.New
so like this:
For Requestor Name control, property DefaultSelectedItems
If
(
SharePointForm1.Mode = FormMode.New
,{
DisplayName:User().FullName,
Claims:"i:0#.f|membership|" & Lower(User().Email),
Email: User().Email,
Picture:""
}
)
and for Data control - Default property
If(SharePointForm1.Mode = FormMode.New,varUser.myProfile.mail)
See if it helps @CarrieECalvi
User | Count |
---|---|
250 | |
105 | |
82 | |
51 | |
43 |