You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
Using any token in provisioning template should use the correct token/stringValue for Lookup value
Observed Behavior
When creating DataRows in a list, the code fails with error Apply-PnPProvisioningTemplate : Input string was not in a correct format.
Explanation:
There is token parsing code on the line 295, but if parsed value converts to, for example, 2, the code on the line 433 returns false as 2 has no splitting characters. After that, code on the line 444 executes, but instead of using processed value (with replaced tokens) it is using raw tokenized value (valuesToSet[key]) and int.Parse fails.
Possible solution:
Use value instead of valuesToSet[key] on the line 444 in ListItemUtilities.cs
Potentially the line 435 needs a fix as well because value is used in the condition, but never used to build the lookup value (multiValue)
Just a suggestion to replace everything from 433 to 446 with something like
and possibly check some logic to on the following code so if multiValue is empty this will unset existing value from the list record in Overwrite mode
Steps to Reproduce
Provision a list with data where a field is using a parameter value:
.....
pnp:Parameters
<pnp:Parameter Key="MyNumber" Required="true"/>
.....
<pnp:DataRows KeyColumn="Title" UpdateBehavior="Skip">
pnp:DataRow
<pnp:DataValue FieldName="ALookupColumn">{parameter:MyNumber}</pnp:DataValue>
</pnp:DataRow>
</pnp:DataRows>
</pnp:ListInstance>
SLTKA
changed the title
[BUG] Missing parser.ParseString in UpdateListItem
[BUG] Missing parser.ParseString in UpdateListItem for Lookup fields
Sep 24, 2020
Category
[x] Bug
[ ] Enhancement
Environment
[x] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013
Expected or Desired Behavior
Using any token in provisioning template should use the correct token/stringValue for Lookup value
Observed Behavior
When creating DataRows in a list, the code fails with error
Apply-PnPProvisioningTemplate : Input string was not in a correct format.
Explanation:
There is token parsing code on the line 295, but if parsed value converts to, for example,
2
, the code on the line 433 returnsfalse
as2
has no splitting characters. After that, code on the line 444 executes, but instead of using processed value (with replaced tokens) it is using raw tokenized value (valuesToSet[key]
) andint.Parse
fails.Possible solution:
Use
value
instead ofvaluesToSet[key]
on the line 444 inListItemUtilities.cs
Potentially the line 435 needs a fix as well because
value
is used in the condition, but never used to build the lookup value (multiValue
)Just a suggestion to replace everything from 433 to 446 with something like
and possibly check some logic to on the following code so if
multiValue
is empty this will unset existing value from the list record inOverwrite
modeSteps to Reproduce
Provision a list with data where a field is using a parameter value:
.....
pnp:Parameters
<pnp:Parameter Key="MyNumber" Required="true"/>
.....
<pnp:DataRows KeyColumn="Title" UpdateBehavior="Skip">
pnp:DataRow
<pnp:DataValue FieldName="ALookupColumn">{parameter:MyNumber}</pnp:DataValue>
</pnp:DataRow>
</pnp:DataRows>
</pnp:ListInstance>
Link to code
PnP-Sites-Core/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/Utilities/ListItemUtilities.cs
Line 444 in cee6297
The text was updated successfully, but these errors were encountered: