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 / Facing issue while add...
Power Apps
Unanswered

Facing issue while adding record in offline mode due to Lookup datatype of column into CDS

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Experts,

I am creating app for offline mode. Data source is CDS. I am adding a record into CDS into offline mode. But in that I have two column having datatype lookup how can I fill those columns in offline mode.
Code is-

If(
 Connection.Connected, //if online
 Patch(
 Journeys, //write new record to database
 Defaults(Journeys),
 { //with content fromcontrols
 cre08_name:TextInput2.Text,
 cre08_journeystartdateandtime:DatePicker1.SelectedDate //need date and time here
 }
 ), //or if not online
 Collect( //add the same data to a collection
 JourneyColletion,
 {
 cre08_name:TextInput2.Text, 
 cre08_journeystartdateandtime:DatePicker1.SelectedDate // need date and time here
 }
 ); //and save the updated data to the device
 SaveData(
 JourneyColletion,
 "Saveitemstokeep"
 )
)

I tried adding those columns in patch and collect but for patch it throws error saying "the specified column does not exists " and  "the patch has invalid arguments". And for collect it says" the collect has some invalid arguments" 

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @WarrenBelz ,

    Please guide me.

     

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi@Tejasvi_munge,

    Based on the issue that you mentioned, do you want to create records for CDS in the offline App?

    Could you please share more about your CDS column?

    cre08_name
    cre08_journeystartdateandtime

    These two column name you specified seems like that they are just predefined names which are pre-populated based on the Display name you enter. 

    In CDS, there are "Display name" and "Name" which are different. You can check the picture below for reference.

    004.png005.png

    So please modify your formula with the real entity column name. I assume that 'name' is the real column name, replace 'cre08_name' with 'name'. So does  'cre08_journeystartdateandtime', replace it with 'journeystartdateandtime'.

    Further, the Date field in CDS includes Date and Time, the format of this field should be below.

    DatePicker1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)

    In general, please modify your formula with the real entity column name and format date and time as below

     

    If(
     Connection.Connected, 
     Patch(
     Journeys, 
     Defaults(Journeys),
     { 
     name:TextInput2.Text,
     journeystartdateandtime:DatePicker1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)
     }
     ), 
     Collect( 
     JourneyColletion,
     {
     name:TextInput2.Text, 
     journeystartdateandtime:DatePicker1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0) 
     }
     ); 
     SaveData(
     JourneyColletion,
     "Saveitemstokeep"
     )
    )

     

     

    Best Regards,

    Qi

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-qiaqi-msft ,

    Thank you for the response!
    Firstly, the reason I am using name instead of display name is one of my column name is "Company ID" and using this display name it shows me error. So I used name instead of display name in power apps and it is working. Secondly, regarding the time and date thing I have done just like what you mentioned. But my problem how can I send value to CDS column having lookup as datatype just like other columns? 

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

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard