cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
forbudt4u
Helper I
Helper I

Patching column in separate list based on LookUp

I'm sure this isn't all that complex, but it is in my head right now.  I have an Audit Detail Screen where I check items in that are present during the audit.  At the end of the audit I press a "Mark Audit Complete" button that has OnSelect properties that patches the respective records in my 'All Asset List' SharePoint List.  This is pretty simple, however, I have a separate list called "Contact" that has a column named 'Previous Audit' it that I'm trying to have the patch enter Now() in that respective Auditee's record's 'Previous Audit' Column as part of the patch.  I've tried If's and Lookups and cannot get anything to work.  Where I'm really getting stuck is in the Patch where I enter the "RECORD" for the contact itself, as it's telling me it's expecting a record rather than Text.  Below is my logic with the names of the respective lists and controls.  

 

  • Auditee: Part of the Audit Gallery Record (AuditGallery.Selected.Auditee)
  • Contact: A list of contacts, so the Title column would be the name of the record... but this isn't available as part of the patch after I enter the DataSource Contact list.  
  • Logic: Take the Auditee name, lookup that Auditee's Contact Record in the Contact List and update the 'Previous Audit' field to be Now().  
  • Code that's failing based on logic

 

 

If(AuditGallery.Selected.Auditee=LookUp(Contact,ID=AuditGallery.Selected.ID,Title),
   Patch(
       Contact,Title,
       {
           'Previous Audit':Now()
       }
    )
);​

 

 

  • Notes: I'm not sure how the patch isn't seeing the Title as the Contact record name, but when I do the below simple LookUp function it works fine and gives the correct result??

 

 

LookUp(Contact,Title=AuditGallery.Selected.Auditee,Title)​

 

 

Any help would be greatly appreciated... and I can provide any additional info that would be needed.  Thanks.  

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @forbudt4u ,

Try this

Patch(
   Contact,
   {Title:AuditGallery.Selected.Auditee},
   {'Previous Audit':Now()}
)

 

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.

View solution in original post

@WarrenBelz   

 

I changed the code to the ID and it's working now...  I'm not sure why I didn't consider this before, but still not sure why it's not updating based on the name either. 

Patch(
   Contact,
   {ID:AuditGallery.Selected.ID},
   {'Previous Audit':Now()}
)

 Can you explain what's happening here? I can see that the "Record" is missing (after Contact) from this code... but is the next part {ID:AuditGallery.Selected.ID} actually replacing where the Record should go?  By appearance it looks like the patch would update the ID field itself.  

 

Anyways, just trying to learn the language... thanks for the guidance!!!

View solution in original post

9 REPLIES 9
WarrenBelz
Super User III
Super User III

Hi @forbudt4u ,

Try this

Patch(
   Contact,
   {Title:AuditGallery.Selected.Auditee},
   {'Previous Audit':Now()}
)

 

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.

View solution in original post

@WarrenBelz 

 

The OnSelect took the coding with no errors, but after the patching was over the Previous Audit column didn't update.  When I went back into the OnSelect properties there was an error that says Title: Field 'Title' is required.  This is what I was saying in my original post about the record options not coming up after I put the source (Contact List) in.  Below I have attached screencaps of the Contact List Settings showing that Title is a column in the list as well as the properties for the Title Column.  I'm not sure if the Red writing below the Enforce Unique Values matters, but maybe this info could help figure out what the issue is?

 

ContactListSettings.PNG

ContactListTitleColumnProperties.PNG

  

@forbudt4u ,

Just change both those checkboxes to "No".

 

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.

@WarrenBelz 

 

Okay, so I did that and the patch went through.  However, all it did was create a new contact record with the only info showing is the Previous Audit date.  I want to update the already existing contact record to reflect the most recent audit date.  

@forbudt4u ,

Obviously this part

{Title:AuditGallery.Selected.Auditee}

is not matching (which I took off the code you said worked).

I am a little concerned looking back on it as this is the Title column, which has been set up to contain a name, with only one record unique title value, so if it does not match the Auditee selected in the gallery, you will get exactly what happened.

You need to check that this matches, so put a Label on the screen with 

AuditGallery.Selected.Auditee

and see if you get the same value as the Title field in the record you are trying to Patch to.

 

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.

@WarrenBelz 

Yes, the label sure does contain the name of the person (contact) I'm trying to patch to... this is baffling the heck out of me.  

@WarrenBelz   

 

I changed the code to the ID and it's working now...  I'm not sure why I didn't consider this before, but still not sure why it's not updating based on the name either. 

Patch(
   Contact,
   {ID:AuditGallery.Selected.ID},
   {'Previous Audit':Now()}
)

 Can you explain what's happening here? I can see that the "Record" is missing (after Contact) from this code... but is the next part {ID:AuditGallery.Selected.ID} actually replacing where the Record should go?  By appearance it looks like the patch would update the ID field itself.  

 

Anyways, just trying to learn the language... thanks for the guidance!!!

View solution in original post

@forbudt4u ,

That was actually the next thing I was going to suggest as I use the ID for all Patches (it is always unique)

@WarrenBelz 

 

I do as well, but didn't in this case because there's not an ID colum listed in the list.  Oh well, it's working.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Top Kudoed Authors
Users online (89,595)