cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Is there really no simple way to patch into a hyperlink field on SharePoint?

Hi there!

I'm trying to create a "Create" button that essentially only needs 4 properties to create an MainEvent.

 

Name

Date

Who created the event

A URL to a online picture to use for the event

 

The problem is i am using a "hyperlink" field for the picture and I can't get it to patch

 

 

If(
    MainEventNavnInput.Text = "";
    UpdateContext({msg_visible: false});;
    UpdateContext({msg_visible: true});
    Patch(
        MainEvent;
        Defaults(MainEvent);
        {
            MainID: Text(
                Value(
                    First(
                        Sort(
                            MainEvent;
                            Value(MainID);
                            Descending
                        )
                    ).MainID
                ) + 1
            );
            Titel: MainEventNavnInput.Text;
            MainDateCreated: DatePicker1.SelectedDate;
            Opretter: CurrentUser.FullName;
            PictureEvent: BilledeLinkInput.Text
            
        }
    )
)

 

 

Is there really no simple solution for setting an URL to PictureEvent from BilledeLinkInput.Text.

 

And if not, anyone care to help me learn more about how i create this flow? 🙂

4 REPLIES 4
Alex_10
Super User
Super User

@Anonymous 

if the the code you mentioned gives you "Invalid URL" error, that means you need to patch a valid url string (must start with http:// or https://)  

Patch(MainEvent, Defaults(MainEvent), {....., PictureEvent: "https://yourURL.xx"})

 

Anonymous
Not applicable

Hi @Alex_10 .

 

Thank you for replying. 

 

I am currently NOT getting any errors at all.

PictureEvent is a hyperlink field where there is a "URL address" and "alternate text" (translation might be a bit off, i'm danish).

 

If i remove "PictureEvent", the code works fine. 

I guess i am mostly baffled that there seems to be no direct way to patch to a hyperlink field in SharePoint without the use of flow.  

ganeshsanap
Memorable Member
Memorable Member

@Anonymous,

As per below blog post by @mdevaney, it should work for you with simple text input.

PATCH A SharePoint Hyperlink Column In Power Apps 

 

Example

Patch(
    Vendors,
    Defaults(Vendors),
    {
        Title: TextInput_Title.Text
        WebsiteHyperlink: TextInput_Website.Text
    }
)

Firstly, try passing simple URL like https://www.google.com


Please click Accept as solution & ‌‌👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

Best Regards,

Ganesh Sanap

Blog site 

Anonymous
Not applicable

Hi @ganeshsanap 

 

I have tried simply modifying the code to 

 

If(
    MainEventNavnInput.Text = "";
    UpdateContext({msg_visible: false});;
    UpdateContext({msg_visible: true});
    Patch(
        MainEvent;
        Defaults(MainEvent);
        {
            MainID: Text(
                Value(
                    First(
                        Sort(
                            MainEvent;
                            Value(MainID);
                            Descending
                        )
                    ).MainID
                ) + 1
            );
            Titel: MainEventNavnInput.Text;
            MainDateCreated: DatePicker1.SelectedDate;
            Opretter: CurrentUser.FullName;
            PictureEvent: "https://www.google.com"
            
        }
    )
)

 

It still isn't adding a new event. 

As i said, if i delete "PictureEvent" from the code - it does. 

 

In SharePoint PictureEvent is set to "Link". If i change it to "picture" it does not change anything. 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,550)