Hi all,
I have a SharePoint list with names of people and some columns ("Product" by example), and I have a button that creates messages to send based on this list of people, so the body of the message is taken from a text template and I want to replace some tags inside the text template for values of the user:
ForAll('PAX INFORMATION',
Patch('Messages', Defaults('Messages'),
{Title:ThisRecord.PaxName,
Phone:ThisRecord.Mobile,
Body:Substitute(LookUp('PUM Template Messages', Lang = Language , Message), "#PRODUCT#", ThisRecord.Product),
Language:ThisRecord.Lang,
Status:"Pending"}));
The message is created but with the default text template message, the Substitute is doing nothing here.
How can I solve this issue?
Thanks in advance,
You are amazing man, a great contributor to this community.
It is works!
Thank you so much!!
Hi @EmilioRoqueta69 ,
I am making a couple of assumptions here as to where your data is located, but try this
Patch(
'Messages',
ForAll(
'PAX INFORMATION' As _Pax,
{
Title: _Pax.PaxName,
Phone: _Pax.Mobile,
Body:
Substitute(
LookUp(
'PUM Template Messages',
Lang = _Pax.Language,
).Message,
"#PRODUCT#",
_Pax.Product
),
Language: _Pax.Lang,
Status: "Pending"
}
)
)
Also, ForAll() is not designed to be a Loop, although it can work this way with considerable performance penalty as it does an individual Patch for each record. ForAll() creates a Table, which can be patched in one action provided its content is correct. For new records, this is simply a Table with field names and field types matching the list.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
WarrenBelz
770
Most Valuable Professional
stampcoin
494
MS.Ragavendar
399