How to set condition to look at contacts related to custom object

If i’m understanding this right, you could add another condition that is exactly the same as the first, except that the field is the “real” WhoId. Then use a “Grouping Logic” statement. For your case it looks like the grouping logic would be 1 AND (2 OR 3) 1 would be your status condition, 2 would be your “fake” whoId condition, and 3 would be your “real” whoId condition. To enter grouping logic for your conditions, just click on the conditions bar underneath your model name.

Yes, but we wouldn’t want rule 2 to apply for new contacts, because then it will be adding tasks with blank WHOIDs to the field. (Because they will have a blank Old Account ID)

There are probably a few crazy things you could do, but they might be a little complicated. This is the first idea that came to me. You could create 2 new models based on the Contact object. One called “Old contacts” and one called “New contacts” and filter them appropriately. Just make sure they’re placed in order before the Task model. Then you could base condition 2 on “Old contacts” and condition 3 on “New Contacts”. You could still have your original Contact model for it’s original purpose.

I’m guessing you can’t write any kind of anonymous apex, or batch apex to just fix everything, since this is a PE org, right?

Right, our best option is temporary data loader access from SF for a day or so to get it straightened out. This averts the crisis though for 99% of tomorrow, so thanks for your help Ben!

Ben, Thanks again for the help last night. We are trying to work with SF to get data loader temporarily. In the meantime, we would like to explore an option for our user’s task lists which displays links to the contact / family records based on the custom WHOID field. Do you know if you could possibly point us in the right direction with a Render Snippet for the WHOID column?

Hi Greg, Since you already have a contacts model on your page, you can use that to match a name to your custom WhoId field in your custom field renderer. Here would be the code to do something like that. Include this in your resources tab as and “inline (snippet)” type. Then reference that snippet in a custom field renderer on your custom WhoId field.

var $ = skuid.$; var field = arguments[0]; var value = arguments[1]; // Get the Contact model you already have on this skuid page var contactModel = skuid.model.getModel('Contacts'); // Search the contact model for a record with this id var contactRow = contactModel.getRowById(value); var link = $('<a>').prop('href','/' + value); if (contactRow) { link.text(contactRow.Name); field.element.append(link); } 

I forgot to add, make sure the Name field is in your Contacts model. I had just FirstName and LastName in my model when I was building this, and nothing showed up until I added the Name field to my model.

Ben - also to make sure - this script should be comparing the custom WHOID field on the activity to the custom “Old Contact ID” field on the contact record, and displaying a link to either the new contact record (or preferably straight to the family record). Does this script do that? It looks like it is comparing the “WHOID” to the new contact ID (which will not find a match), but I’m not a jquery expert either. My column is also blank, so that indicates something may be amiss.

In that case, you’ll need to try something like this…

var $ = skuid.$; var field = arguments[0]; var value = arguments[1]; // Get the Contact model you already have on this skuid page var contactModel = skuid.model.getModel('Contacts'); // Search the contact model for a record with this id var contactRow; $.each(,function(){ console.log(this); console.log(this.Old_Contact_Id__c); console.log(value); if (this.Old_Contact_Id__c === value) { contactRow = this; return false; } }); console.log(contactRow); var link = $('<a>').prop('href','/' + contactRow.Id); if (contactRow) { link.text(contactRow.Name); field.element.append(link); } 

Things to note, this custom renderer needs to be on the custom “WhoId” field. Otherwise, “value” will not be correct. I put in some console.logs so that you can check your javascript console and see what is going on. I may not have gotten your field names exactly right (they are case sensitive as well), but I think you can get the gist. If you get it working, you should remove the console.logs.

Ben, My page is still blank, and I’m getting the following error in my log: Uncaught TypeError: Cannot read property ‘Id’ of undefined

move the “var link…” line into the if statement below it, that will get rid of that error. You can also look in your console to see the output of those logs.

Ben - I loaded up my log into a pastebin - the page stopped going blank (In Chrome and IE10 - is still blank in IE9), but nothing is appearing in the column. The pastebin is set to expire in 1 day:

It looks like the problem is with this line… this.Old_Contact_Id__c This has to be the exact case sensitive name of your old contact field. This also must be included as a field in your contact model.

Ben, the exact field name is Old_Contact_ID__c (copied directly from the model) Here is my version of the two lines referencing that field: console.log(this.Old_Contact_ID__c); if (this.Old_Contact_ID__c === value) {

ok, one more thing I can think of, can you give me that same console output, but use Chrome’s console, or something that will show something other than “Object” for the output for that field? Sometimes you have to click the little arrow next the console output to drill into that log. I really need to see the contents of that “Object”.

Ben, I had to uncollapse each one manually in Chrome, so I only did a couple, but here’s another pastebin:

well, i’m at a loss, it seems like it should be working. Can you copy/paste your exact code for the snippet here, or grant Skuid LLC access to your org, so I can take a look?

Rob, I gave login access from our admin account to Skuidify LLC Support. Do you know when you might have time to take a look? Thanks so much!

Hi Greg, I logged into your org, and I’m assuming that the FamilyView page is what you were working on, but I didn’t see that field or snippet on the page. Should I be looking at a different page?