web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can't chose ID value f...
Power Apps
Answered

Can't chose ID value from Set patched record

(0) ShareShare
ReportReport
Posted on by 44

Hello,

I'm creating a function which will duplicate SP record that already exists, to my flow I need ID of the newly created record to send also attachments. As always I used Set() for Patch with Defaults()  but I can't get ID

michalborek_1-1705569096929.png

Set(pathrecord;
 Patch(
 _szablonow;
 Defaults(_szablonow);;
 {
 historia: VarCurRecord.historia;
 RodzajUslugi: VarCurRecord.RodzajUslugi;
 TypSurowki: VarCurRecord.TypSurowki;
 NazwaSzablonu: VarCurRecord.NazwaSzablonu;
 Tytuł: VarCurRecord.Tytuł;
 Status: VarCurRecord.Status;
 NrZleceniaCWM: VarCurRecord.NrZleceniaCWM;
 Zaklad: VarCurRecord.Zaklad;
 OdpowiedzialnyZaZamowienie: VarCurRecord.OdpowiedzialnyZaZamowienie;
 PotwierdzonaData: VarCurRecord.PotwierdzonaData;
 TypSzablonu2: {Value: "XXXXXXXXX"};
 szczegolyszablonu2: VarCurRecord.szczegolyszablonu2;
 HistoriaStatusu: VarCurRecord.HistoriaStatusu;
 DataDostarczenia: VarCurRecord.DataDostarczenia;
 Tokaj_elementy: VarCurRecord.Tokaj_elementy;
 OsobaDoKontaktu: VarCurRecord.OsobaDoKontaktu;
 OdpowiedzialnyZaWykonanie: VarCurRecord.OdpowiedzialnyZaWykonanie;
 TypZgloszenia: VarCurRecord.TypZgloszenia;
 SzczegolySzablony: VarCurRecord.SzczegolySzablony;
 Szczegoly: VarCurRecord.Szczegoly;
 ZamowionePrzez: VarCurRecord.'Utworzone przez'
 }
 ))
;;duplicate_attachemnt.Run(VarCurRecord.'Identyfikator (ID)'; pathrecord.'Identyfikator (ID)')

what can be wrong ?

Categories:
  • CU18061035-1 Profile Picture
    Microsoft Employee on at

    hey @michalborek 

     

    please try this:

    // Step 1: Create a New Record
    Patch(
     _szablonow,
     Defaults(_szablonow),
     {
     historia: VarCurRecord.historia,
     RodzajUslugi: VarCurRecord.RodzajUslugi,
     TypSurowki: VarCurRecord.TypSurowki,
     NazwaSzablonu: VarCurRecord.NazwaSzablonu,
     Tytuł: VarCurRecord.Tytuł,
     Status: VarCurRecord.Status,
     NrZleceniaCWM: VarCurRecord.NrZleceniaCWM,
     Zaklad: VarCurRecord.Zaklad,
     OdpowiedzialnyZaZamowienie: VarCurRecord.OdpowiedzialnyZaZamowienie,
     PotwierdzonaData: VarCurRecord.PotwierdzonaData,
     TypSzablonu2: {Value: "XXXXXXXXX"},
     szczegolyszablonu2: VarCurRecord.szczegolyszablonu2,
     HistoriaStatusu: VarCurRecord.HistoriaStatusu,
     DataDostarczenia: VarCurRecord.DataDostarczenia,
     Tokaj_elementy: VarCurRecord.Tokaj_elementy,
     OsobaDoKontaktu: VarCurRecord.OsobaDoKontaktu,
     OdpowiedzialnyZaWykonanie: VarCurRecord.OdpowiedzialnyZaWykonanie,
     TypZgloszenia: VarCurRecord.TypZgloszenia,
     SzczegolySzablony: VarCurRecord.SzczegolySzablony,
     Szczegoly: VarCurRecord.Szczegoly,
     ZamowionePrzez: VarCurRecord.'Utworzone przez'
     }
    );
    
    // Step 2: Retrieve the New Record's ID
    // Replace 'NazwaSzablonu' and 'Tytuł' with fields that uniquely identify the new record
    Set(newRecord, LookUp(_szablonow, NazwaSzablonu = VarCurRecord.NazwaSzablonu && Tytuł = VarCurRecord.Tytuł));
    
    // Step 3: Run the Attachment Duplication Process
    // Use 'newRecord' to get the ID of the new record
    duplicate_attachemnt.Run(VarCurRecord.'Identyfikator (ID)', newRecord.'Identyfikator (ID)');

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • michalborek Profile Picture
    44 on at

    Dear mmbr1606,

     

    Thank you for your suggestions, to do that I have to add one more column with GUID(), and eventually, I will do this but I wonder why this ID is not in my global variable. I used this method previously and it worked with ID 

  • Verified answer
    michalborek Profile Picture
    44 on at

     

    in my code there is a typo instead of ";" i have ";;". Now everything is working.

    Defaults(_szablonow);;
     {

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard