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 / Create an item on the ...
Power Apps
Unanswered

Create an item on the FLY and pass it to the form, Why only single line of text fields will be populated

(0) ShareShare
ReportReport
Posted on by 3,514

I want to implement a Copy Item functionality >> so inside my Gallery i added a Copy icon >> with this OnSelect, where i am trying to create a variable on the fly, as follow:-

 

Set(newExpiry,
{Title:Gallery1_1.Selected.Title,
'Sales Program ID':{Value:Gallery1_1.Selected.'Sales Program ID'},
'Effective Date':Gallery1_1.Selected.'Effective Date',
'End Date.':Gallery1_1.Selected.'End Date.',
'New End Date':Gallery1_1.Selected.'New End Date'
,Amount:Gallery1_1.Selected.Amount,
'Accrual Amount':Gallery1_1.Selected.'Accrual Amount',
'Payment Type':Gallery1_1.Selected.'Payment Type',
'Product Code':Gallery1_1.Selected.'Product Code',
'Item Rebate Group':Gallery1_1.Selected.'Item Rebate Group',
'Requested By':Gallery1_1.Selected.'Requested By',
'Date Requested':Gallery1_1.Selected.'Date Requested',
'Date of Expiry Requested':Gallery1_1.Selected.'Date of Expiry Requested',
'Additional Comments':Gallery1_1.Selected.'Additional Comments',

'Program Entered By':Gallery1_1.Selected.'Program Entered By',
Approver:Gallery1_1.Selected.Approver,
IsCopy:{Value:"True"}
}); 
EditForm(ExpiryForm);Navigate(ExpiryCRUD);

 

and on the ExpiryCRUD Form >> i define this formula inside the items:-

 

If(!IsBlank(newExpiry),newExpiry,If(varExpiryID>0 ,LookUp('Rebate Expiry Form',ID=varExpiryID),If(!IsBlank(varSetupID),LookUp('Rebate Expiry Form',RealtedFormID=varSetupID))))

 

currently only the text (single line of text) field will be per-populated based on the variable i created on the fly .. any advice on this? while Date fields, People/group fields and choice fields are not going to be per-populated ..

 

Categories:
  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    @johnjohn123 ,
    A conditional Item on a Form (like conditional Items in a Gallery or drop-down are never a good idea and often simply do not work), but you need to at least have all the options in the same structure (all looking up the List, not having one as a Variable) - your Variable to add the ID from the gallery

    With(
     {wSel: Gallery1_1.Selected},
     Set(
     newExpiry,
     {
     Title:wSel.Title,
     'Sales Program ID': {Value: wSel.'Sales Program ID'},
     'Effective Date': wSel.'Effective Date',
     'End Date.': wSel.'End Date.',
     'New End Date': wSel.'New End Date',
     Amount: wSel.Amount,
     'Accrual Amount': wSel.'Accrual Amount',
     'Payment Type': wSel.'Payment Type',
     'Product Code': wSel.'Product Code',
     'Item Rebate Group': wSel.'Item Rebate Group',
     'Requested By': wSel.'Requested By',
     'Date Requested': wSel.'Date Requested',
     'Date of Expiry Requested': wSel.'Date of Expiry Requested',
     'Additional Comments': wSel.'Additional Comments',
     'Program Entered By': wSel.'Program Entered By',
     Approver: wSel.Approver,
     IsCopy: {Value: "True"},
     NewID: wSel.ID
     }
     )
    ); 
    EditForm(ExpiryForm);
    Navigate(ExpiryCRUD);

    then try this on the Item of the Form

    If(
     !IsBlank(newExpiry.ID),
     LookUp(
     'Rebate Expiry Form',
     ID = newExpiry.ID
     ),
     varExpiryID > 0,
     LookUp(
     'Rebate Expiry Form',
     ID = varExpiryID
     ),
     !IsBlank(varSetupID),
     LookUp(
     'Rebate Expiry Form',
     RealtedFormID = varSetupID
     )
    )

     

    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

     

  • johnjohn123 Profile Picture
    3,514 on at

    @WarrenBelz but i think in this case i will have a update instead of Insert, since i am passing the Id of an exsisting item ?

     

  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    @johnjohn123 ,

    I am not sure what you mean. Your posted question was about the Item of the Form and I am pointing out if you want to make it conditional, the options need to be identical structure. If your gallery has no ID field (is this a new record ?), then I do not believe that you can do this with one Form.

  • johnjohn123 Profile Picture
    3,514 on at

    @WarrenBelz the Id is the sharepoint built-in field, which will be available to every sharepoint list

  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    @johnjohn123 ,

    Yes I obviously know that but did not know what was in your gallery. Does the code I sent assist you ?

  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    @johnjohn123 ,

    I assume from this new post that you no longer require assistance on this one and it can be closed ?

  • johnjohn123 Profile Picture
    3,514 on at

    @WarrenBelz thanks, i am trying different approaches to create an item on the FLY, so the 2 posts are dealing with 2 different approaches to achieve the same goal.

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 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard