cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Elitezone
Post Prodigy
Post Prodigy

Notification success / DisplayName

Hello,

 

If(
    User().Email in Split(
        ThisItem.'Kto polubił';
        ";"
    );
    Notify("Możesz polubić propozycję tylko raz."; NotificationType.Error);
    Patch(
        IdeaBox_1;
        ThisItem;
        {
            Polubienia: ThisItem.Polubienia + 1;
            'Kto polubił': ThisItem.'Kto polubił' & ";" & User().Email
        }
    ))

 

 

I have this function on my button - it is for LIKE functionality.

 

I have two problems.

 

1) I have no idea how to add NotificationSuccess when patch action is sucessful.

One of the users tried to help me, but his solutions failed.

 

I would like to add a message:

 

Notify("Polubiono!"; NotificationType.Success);

 

Is that possible? 

 

 

Set(varRecord, Patch(your_code_here));
If(!IsBlank(varRecord),
    Notify("Your request has been submitted!", Notification.Success),
    Notify("Your request was not submitted", Notification.Failure)
);

 

I found this function but I have problems in using that.

 

Another question is that I have this sharepoint field 'Kto polubił' (who liked)

Is stores users e-mails and prevent them from liking propositions more than once (function Notification Failure)

It stores emails like that:

email;email;email

 

I would like to use this field to show list of users that liked. I made gallery, table, tooltip and others with this field and it worked! But it shows e-mail address. Is it possible to reformat this field to shows users name as it is more clear? In my organisation e-mails are a lot different from names.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Elitezone 

 

Try to replace the last patch line 

Patch(IdeaBox_1;ThisItem;{WhoLikedPeople:TempTable});)

with the below line 

Patch(IdeaBox_1,LookUp(IdeaBox_1,ID=ThisItem.ID),{WhoLikedPeople:TempTable});)

 

Best Regards

Mark

View solution in original post

25 REPLIES 25
Elitezone
Post Prodigy
Post Prodigy

Please help me. I tried many ways but none worked 😞

Thank you!

Hi @Elitezone 

 

You seem very close with your solution. 

For the notifications, You can do something similar to what you did and It should work ,

You can add this to the Like buttom OnSelect

If(User().Email in Split(ThisItem.WhoLiked,";"),Notify("Możesz polubić propozycję tylko raz.",NotificationType.Error),Set(varRecord,Patch(ItemLikes,ThisItem,{WhoLiked:Concatenate(ThisItem.WhoLiked&";",User().Email)}));If(!IsBlank(varRecord),Notify("Your request has been submitted!",NotificationType.Success),Notify("Your request was not submitted", NotificationType.Error));)

 

This will show the email only , but in your last part you mentioned you want to display the username and not the email 

I suggest to fix this in the data source (SharePoint List) to minimize the work in the powerApps , 

So what you can do is to create a SharePoint field of type People and allow multiple select on it , so you can add many users.
This field use hold SPUser so you can retrieve the name or email based on your need. 

Best Regards

Mark 

 

 

 

Ok - maybe I explained my problem badly

@Mark-Shenouda 

 

What I need is a lot simpler than your solution 🙂

 

If(
    User().Email in Split(
        ThisItem.'Kto polubił';
        ";"
    );
    Notify("Możesz polubić propozycję tylko raz."; NotificationType.Error);
    Patch(
        IdeaBox_1;
        ThisItem;
        {
            Polubienia: ThisItem.Polubienia + 1;
            'Kto polubił': ThisItem.'Kto polubił' & ";" & User().Email
        }
    ))

For topic number 1 I only need to add a message to this function when Patch function is sucessful. I do not need to show e-mail or anything. Just a simple message "You liked that!"

 

Topic number 2 is a bit more complex - I think I should have made another thread as it was misunderstood.

Topic number 2 is not releted with 1 - they just use same function.

 

Right now I have a field Kto polubił it stores e-mail of people who liked a change and is also used as a validator to prevent people from liking.

I would like to modify it to store also name or change it so it will story names only - but still works as a validator.

 

I want to do it because I want to create later a gallery that will print names of people who liked a modification so people can see who liked theirs ideas.

 

I was looking for an easy way to estabilish that, but I am not very good in Sharepoint List so I do not know how to make relations betweens field or anything.

I need e-mail relation with name. If I add another field called NAME and it will store data the same way as field Kto polubił then how will those fields be linked? 

 

Email1;Email2;Email3

 

Name1;Name2;Name3

 

This is how those fields will look like.

They need to be in correct order to work or I need something more.

Hi @Elitezone 

 

It is ok, let me simplify my answer to you 

Topic 1 :  Add a message to this function when Patch function is successful

As I mentioned your answer is pretty close , I used your code and added the success message in the snippet that I posted , let me clarify it. I replaced the patch section with 

 

Set(varRecord,Patch(Your Patch Logic));
If(!IsBlank(varRecord),Notify("You Liked!",NotificationType.Success),Notify("Like Failed", NotificationType.Error))

 

What happens is I set a variable(varRecord) with the output of the Patch, Then using if statement I check on this variable if it is not blank then the batch is successful , if not you can display error message. 

 

so you just insert this in the below section and it should work

 

 

If(
    User().Email in Split(
        ThisItem.'Kto polubił';
        ";"
    );
    Notify("Możesz polubić propozycję tylko raz."; NotificationType.Error);
    
   //Setting the var,The modified Patch logic,adding success message/failure    

)

 

 

 

Topic 2: Store Names of Users/Emails

 

There is no need to do relation with the name and the email, See there a field type in SharePoint that holds a user object , so instead of using a text field with semicolon separated mails , You can use this field type (Person)

 

column.png

 

and instead of saving a email , you save a user , of course this will change the previous logic and syntax little 

 

Hope this is more clear now.

 

Best Regards

Mark

 

 

 

 

If(
    User().Email in Split(
        ThisItem.'Kto polubił';
        ";"
    );
    Notify("Możesz polubić propozycję tylko raz."; NotificationType.Error);
    Set(varRecord;Patch(
        IdeaBox_1;
        ThisItem;
        {
            Polubienia: ThisItem.Polubienia + 1;
            'Kto polubił': ThisItem.'Kto polubił' & ";" & User().FullName & ";" & User().Email
        }
    ));If(!IsBlank(varRecord);Notify("Polubiłeś tę propozycję!";NotificationType.Success);Notify("Nie możesz polubić tej samej propozycji dwa razy!";NotificationType.Error)))

Seems to be working. Thanks.

 

@Mark-Shenouda 

Now to the second question. Will I be able to use your field to later display this WhoLiked in gallery as a different records?

I really want to show this column as a gallery to allow people to see who liked theirs ideas.

 

My solution works really bad - it shows gallery with a single long record spaced only with ;

Hi @Elitezone 

 

I am glad that the first part is working.

For the second part, The new field of type person will give you much flexibility , as the data will be an array of users, which you can use to display the username or email or even the image. 

For example you can use nested galley to display who liked with their details 

You can try and see what is the data coming from the field. 

 

Best Regards

Mark 

@Mark-Shenouda 

Easier said than done ;(

 

I created new field "person type" - Osoby_Lubiace - and tried to modify this formula.

If(
    User().FullName in Split(
        ThisItem.Osoby_lubiace;
        ";"
    );
    Notify("Możesz polubić propozycję tylko raz."; NotificationType.Error);
    Set(varRecord;Patch(
        IdeaBox_1;
        ThisItem;
        {
            Polubienia: ThisItem.Polubienia + 1;
            Osoby_lubiace: ThisItem.Osoby_lubiace;
        }
    ));If(!IsBlank(varRecord);Notify("Polubiłeś tę propozycję!";NotificationType.Success);Notify("Nie możesz polubić tej samej propozycji dwa razy!";NotificationType.Error)))

My futile try invoked 8 errors - unexpected signes - forma got IDENT where expected CurlyClose, expected : (colon), Invalid type of argument (record) expected text, Function split has invalid arguments, function patch has invalid arguments, Column _ does not exist (what the hell?), Name is invalid. InBlank got invalid arguments.

 

 First I do not know how to check if the user is present in those list. Before it was UserEmail in Split.

 

And I do not know how to Patch this user name. Previous formula was hard enough for me to understand.

 

I thought that I better make a new list with a field 'Kto polubił' and then use LookUp to link it with a previous list - but that would be way harder... but it would allow me to store date of likes...

Hi @Elitezone 

Well, it is expected to have some errors as we changed the type of the field and the data type from String to Person 
So we need to alter the code a little, 

The if statement was checking a table of strings .. now it should check in a table of persons so we need to alter it as below 

If(IsEmpty(Filter(ThisItem.WhoLikedPeople,Email = User().Email))

 

Now for the tricky part which is adding the user to the field, before we used the blow code 

Patch(ItemLikes,ThisItem,{WhoLiked:Concatenate(ThisItem.WhoLiked&";",User().Email)})

We will alter this to do the following , save the current value (Persons) in a temp table , then add the current user to this table and finally update the WhoLiked field. so it will similar to the below 

 

ClearCollect(TempTable,ThisItem.WhoLiked);

Patch(TempTable,Defaults(TempTable),{
DisplayName:User().FullName,
Claims:"i:0#.f|membership|" & Lower(User().Email),
Department:"",
Email:User().Email,
JobTitle:"",
Picture:""
});

Patch(ItemLikes,ThisItem,{WhoLiked:TempTable});

 

This is a quick solution , but I am sure by time you can create great apps 

 

Best Regards 

Mark

 

 

@Mark-Shenouda 

Great help. Trying to make it was very informative.

 

Still this is not my level to make it. I tried to swap my function:

 

If(
    User().Email in Split(
        ThisItem.'Kto polubił';
        ";"
    );
    Notify("Możesz polubić propozycję tylko raz."; NotificationType.Error);
    Set(varRecord;Patch(
        IdeaBox_1;
        LookUp(IdeaBox_1;ID=ThisItem.ID);
        {
            Polubienia: ThisItem.Polubienia + 1;
            'Kto polubił': ThisItem.'Kto polubił' & ";" & User().FullName & ";" & User().Email
        }
    ));If(!IsBlank(varRecord);Notify("Propozycja została polubiona!";NotificationType.Success);Notify("Nie możesz polubić tej samej propozycji dwa razy!";NotificationType.Error)))

 

with yours and it became a 40 errors disaster (I changed delimeter and tried to work it out in a lot of ways)

 

 

If(!IsEmpty(Filter(ThisItem.Osoby_lubiace;Email = User().Email));
Notify("You can like only once."; NotificationType.Error);
Set(varRecord;Patch(
IdeaBox_1;
LookUp(IdeaBox_1;ID=ThisItem.ID);
{
ClearCollect(TempTable;ThisItem.Osoby_lubiace);
Patch(TempTable;Defaults(TempTable);{
DisplayName:User().FullName;
Claims:"i:0#.f|membership|" & Lower(User().Email);
Department:"";
Email:User().Email;
JobTitle:"";
Picture:""
});
Patch(ThisItem.Polubienia;ThisItem;{ThisItem.Osoby_lubiace:TempTable});
        }
    );If(!IsBlank(varRecord);Notify("Proposition was liked!!";NotificationType.Success);Notify("You can't like same proposition twice!!";NotificationType.Error))))

 

and another version with Patch(IdeaBox_1 - this is my data source)

 

If(!IsEmpty(Filter(ThisItem.Osoby_lubiace;Email = User().Email));
Notify("You can like only once."; NotificationType.Error);
Set(varRecord;Patch(
IdeaBox_1;
LookUp(IdeaBox_1;ID=ThisItem.ID);
{
ClearCollect(TempTable;ThisItem.Osoby_lubiace);
Patch(TempTable;Defaults(TempTable);{
DisplayName:User().FullName;
Claims:"i:0#.f|membership|" & Lower(User().Email);
Department:"";
Email:User().Email;
JobTitle:"";
Picture:""
});
Patch(IdeaBox_1;{ThisItem.Osoby_lubiace:TempTable});
        }
    );If(!IsBlank(varRecord);Notify("Proposition was liked!!";NotificationType.Success);Notify("You can't like same proposition twice!!";NotificationType.Error))))

 

This function is on a smiley button.

When user clicks it it check if he hasn't already like it (first filter) - if he did it shows message and block action.

If he haven't liked it allowed him - it increase Polubienia count and should fill Osoby_lubiace person field with his data and shows a message success.

 

I just noticed that function used by me isn't great either - it has two same error messages (or so I believe).

 

Would you be some kind to help a bit more.

This button is in a gallery. I use lookup because this gallery has added tables.

 

I had a problem in your function with ItemLikes (is this a sharepoint list or a field Polubienia (the one that has +1)

I also do not know which part of your formula add +1 value to field that stores amount of likes?

And last question - Can I translate this Claims, Departament etecera or is it not neccessery in this place?

 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,703)