• Jonathan Spink
  • NEWBIE
  • 105 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 27
    Replies
So I'm looping through the records from a List and want to check the value of a field against the value from the previous record. But I want to be able to pass the name of the field to the method. Something like:

public static void (List<Contact> cList, string fieldname) {
integer i = 1;
for ( Contact c : cList) {
if (c[i].fieldname == c[i-1].fieldname) {
...
} else {
...
}

 
I'm coding a set of true/false opions by setting an integer field x to say 9 (1001 in binary), so that if I want to check if any particular bit is set, I do:

x & 8 (= true), or
x & 2 (= false), etc.

But the compiler complains, saying 'Illegal assignment from Integer to Boolean' having also said '& operator can only be applied to Boolean expressions or to Integer or Long expressions'. Hoow can I get this basic functionality to work?
I have rows of data to display on a VF form and on some rows I want to hide the button based on a field value for that row. Everything I try hides the entire column, e.g.

<apex:dataTable value="data" var="c">
    <apex:column>
        <apex:outputText value="{!c.field}/>
        <apex:outputPanel rendered="{!c.rowBoolean}">
            <button type="button">process...</button>
        </apex:outputPanel>
    </apex:column>
</apex:dataTable>
 
We have a method which builds a URL and then uses it to redirect to an external payment collection services. On occasion this appears to time out and two 'Income Card Payment' records are created. Has anywone seen this. What happens if the redirect times out - does SF try again?
In an Apex test I am merging three pairs of Contacts (in a for loop), but before it completes I get this error:

first error: LIMIT_EXCEEDED, System.LimitException: npsp:Too many queueable jobs added to the queue: 2: []

How can I ensure only 1 queueable job is processed at one time?
We have been getting Apex Test failures which have little connection to recent development. Sometimes they go away without any direct intervention. Also, it's often only one sandbox that complains.

I have managed to resolve one and the cause was records being returned from a SELECT statement in a different order from usual. So it seems that if you don't use 'ORDER BY' you can't rely on the order of the records being returned.
I have created 2 new fields on Campaign Member and added these to the Campaign History related list on Contact. So far, so good. But when I retrieve the layout through Ant, the new fields are not on the related list. If I remove or add other fields in the related list they duly disappaer and reappear, but the two new fields do not. Anyone else seen this behavour?
and more weirdly, why is 'Customer Portal Account' blank on both Account records?
When trying to insert a Recurring Donation record in a flow with just Contact ID specified (or just Organisation ID specified), I get the error:

FIELD_CUSTOM_VALIDATION_EXCEPTION, You must select an Organization or Contact: []

It's only happening on sandboxes on Spring '22 not on Production which is still on Winter '22. Has anyone else seen this?
A LWC which was last updated 2 years ago has suddenly generated a 'Component Error': "Error during LWC component connect phase: [Cannot read properties of undefined (reading 'length')]" What is this about?
I think the answer is No, but I haven't seen anything online to confirm this.
When you use the Toggle control on a Flow screen, it has text for Active and Inactive, both of which default to a small point size, i.e. 8 or 9. Neither allow any style to be added to the text, so how can I increase the size of this text?
We have a merge process that takes the user through several pages by them clicking 'Save' each time. How can I get this to run without requiring any user input?
My <apex:outputlink> works fine in Lightning/Classic, but not in my Community ('volunteermanagement'). I have:

<apex:outputLink value="/{!account.id}" target="_top">{!account.name}</apex:outputLink>

but in the community it redirects to:

ttps://mydomain.force.com/volunteermanagement/s/volunteermanagement/AccountHierarchyPage?id=0011p00001cTA2eXXY

It seems to be overcompensating for the community name. What I want is simply:

https://mydomain.force.com/volunteermanagement/s/detail/0011p00001cTA2eXXY

Anyone come across this or have any ideas?

 
The Files Related List is not appearing on a page layout in Lightning, only in Classic. Is this a known issue?
I want to launch my code as a queueable class, but I need to include a parameter. I have tried doing this but at some point I have to make a call that doesn't include parameters, i.e.

public void execute(QueueableContext context) {...
}

Is there any way round this?
 
I have this on my VF page and code to update a related field when an onchange event occurs. Every so often, it fails to respond to the change event for that field. Any ideas?

<apex:inputField value="{!batch.Bank_Date__c}"  >
<apex:actionSupport event="onchange" action="  {!myPaymentMethod}" rerender="BankRef1,BankRef2,recInfo" />
</apex:inputField>
I want to create a custom related list to show a filtered set of records for campaign history on Contact. Is this easier done with Visualforce or a Lightning Component?
I've had to rewrite an Apex Link so it works both in Lightning and inside a Community - but it's clunky as I've had to hard code the community name ('volunteermanagement'):

<apex:outputLink value="/{!pos.account.id}" rendered="{!$User.UIThemeDisplayed == 'Theme4d'}" target="_top">{!pos.account.name}</apex:outputLink>
           
<apex:outputLink value="/volunteermanagement/s/detail/{!pos.account.id}" rendered="{!$User.UIThemeDisplayed != 'Theme4d'}" target="_top">{!pos.account.name}</apex:outputLink>

Can you advise me on something which only requires one statement?

Many thanks

 
I have a Detail Page button with a URL which works in Lightning but not in a Community - instead it gives an 'Address is down for maintenance' error. The URL is:
/apex/VF17_CreateOrder?contactId={!Contact.Id}
The page itself has the 'Available for Lightning Experience, Experience Builder sites, and the mobile app' box ticked.
So I'm looping through the records from a List and want to check the value of a field against the value from the previous record. But I want to be able to pass the name of the field to the method. Something like:

public static void (List<Contact> cList, string fieldname) {
integer i = 1;
for ( Contact c : cList) {
if (c[i].fieldname == c[i-1].fieldname) {
...
} else {
...
}

 
I have rows of data to display on a VF form and on some rows I want to hide the button based on a field value for that row. Everything I try hides the entire column, e.g.

<apex:dataTable value="data" var="c">
    <apex:column>
        <apex:outputText value="{!c.field}/>
        <apex:outputPanel rendered="{!c.rowBoolean}">
            <button type="button">process...</button>
        </apex:outputPanel>
    </apex:column>
</apex:dataTable>
 
We have a method which builds a URL and then uses it to redirect to an external payment collection services. On occasion this appears to time out and two 'Income Card Payment' records are created. Has anywone seen this. What happens if the redirect times out - does SF try again?
We have been getting Apex Test failures which have little connection to recent development. Sometimes they go away without any direct intervention. Also, it's often only one sandbox that complains.

I have managed to resolve one and the cause was records being returned from a SELECT statement in a different order from usual. So it seems that if you don't use 'ORDER BY' you can't rely on the order of the records being returned.
and more weirdly, why is 'Customer Portal Account' blank on both Account records?
When trying to insert a Recurring Donation record in a flow with just Contact ID specified (or just Organisation ID specified), I get the error:

FIELD_CUSTOM_VALIDATION_EXCEPTION, You must select an Organization or Contact: []

It's only happening on sandboxes on Spring '22 not on Production which is still on Winter '22. Has anyone else seen this?
A LWC which was last updated 2 years ago has suddenly generated a 'Component Error': "Error during LWC component connect phase: [Cannot read properties of undefined (reading 'length')]" What is this about?
We have a merge process that takes the user through several pages by them clicking 'Save' each time. How can I get this to run without requiring any user input?
My <apex:outputlink> works fine in Lightning/Classic, but not in my Community ('volunteermanagement'). I have:

<apex:outputLink value="/{!account.id}" target="_top">{!account.name}</apex:outputLink>

but in the community it redirects to:

ttps://mydomain.force.com/volunteermanagement/s/volunteermanagement/AccountHierarchyPage?id=0011p00001cTA2eXXY

It seems to be overcompensating for the community name. What I want is simply:

https://mydomain.force.com/volunteermanagement/s/detail/0011p00001cTA2eXXY

Anyone come across this or have any ideas?

 
The Files Related List is not appearing on a page layout in Lightning, only in Classic. Is this a known issue?
I want to launch my code as a queueable class, but I need to include a parameter. I have tried doing this but at some point I have to make a call that doesn't include parameters, i.e.

public void execute(QueueableContext context) {...
}

Is there any way round this?
 
I want to create a custom related list to show a filtered set of records for campaign history on Contact. Is this easier done with Visualforce or a Lightning Component?
I've had to rewrite an Apex Link so it works both in Lightning and inside a Community - but it's clunky as I've had to hard code the community name ('volunteermanagement'):

<apex:outputLink value="/{!pos.account.id}" rendered="{!$User.UIThemeDisplayed == 'Theme4d'}" target="_top">{!pos.account.name}</apex:outputLink>
           
<apex:outputLink value="/volunteermanagement/s/detail/{!pos.account.id}" rendered="{!$User.UIThemeDisplayed != 'Theme4d'}" target="_top">{!pos.account.name}</apex:outputLink>

Can you advise me on something which only requires one statement?

Many thanks

 
I have a Detail Page button with a URL which works in Lightning but not in a Community - instead it gives an 'Address is down for maintenance' error. The URL is:
/apex/VF17_CreateOrder?contactId={!Contact.Id}
The page itself has the 'Available for Lightning Experience, Experience Builder sites, and the mobile app' box ticked.
User-added image
I tried as suggested in this post but that did not work for me.
https://developer.salesforce.com/forums?id=906F0000000AW30IAG

I tried different browsers, still not loading. 

Any suggestions?