• Oliver Freeman 9
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 10
    Replies
Hey there,

We use a visual flow in Salesforce to generate quotes for repairs, and within the flow, there is a checkbox at the final screen to allow the user to add the quote as a case comment at the end of the flow for future reference. The case ID variable within the flow is 'caseId'.
Usually, caseId is passed in the flow URL as a parameter, as the flow is ran from a URL button on the case page layout, which works perfectly.

I had a thought over the weekend to allow service console users to run the flow from a console component, so I went about creating a Visualforce page to use in the console component:
 
<apex:page standardController="Case">
    
    <apex:iframe src="/flow/Quote_Generator" scrolling="true" id="theIframe"/>
    
</apex:page>
You're probably wondering why I'm using <apex:iframe> - the reason behind this, is that we use the Lightning Runtime for our flows, so that they look a lot nicer for our users.
The component works and the flow runs fine, but obviously I need to pass the current subtab object ID into the flow URL.
I've done a little reading on the Service Console Integration Toolkit, and found that I should be able to do this using 
getFocusedSubtabObjectId()
But I won't lie, I'm not really sure where to start with passing the object ID into the flow URL, and wondered if any of you guys would be able to give me some guidance as to where I should start here.

Would greatly appreciate any help :)

Thanks,
Oli




 
Hello,

We have a custom object which is child to the Case object.
We use a custom New button so that we can set retURLs - the custom object in question has two RecordTypes - after passing the RecordType in the URL for the button, the cancelURL parameter does not pass through - I've tried this URL, but like I say, the cancelURL parameter does not work:

/a0F/e?CF00ND0000005CtcY={!Case.CaseNumber}&CF00ND0000005CtcY_lkid={!Case.Id}&saveURL=%2F{!Case.Id}&retURL=%2F{!Case.Id}&cancelURL=%2F{!Case.Id}&RecordType=012D0000000VCCR


Any help would be massively appreciated!

Thanks
Hi there,

I'm trying to create a list button (OnClick JavaScript), to tick a checkbox on a record from a related list on a case.
I'm wanting to tick a checkbox on a custom object (Contract Loan) which is related to the Case object, without having to go on the record page itself. 

So far, I've written this:
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 
var newRecords = []; 
var c = new sforce.SObject('Contract_Loan__c'); 
c.id ='{!Contract_Loan__c.Id}'; 
c.MSC_Replacement_Device__c ='True'; 
newRecords.push(c); 
var result = sforce.connection.update([c]);

This works for a detail page button on the object page layout, but not a list button, it just doesn't do anything.

Any help greatly appreciated.

Thanks,
Oli
Hello,

I'm trying to create a VF page which will appear on the Case page layout displaying all other cases for the asset on that particular case - here's what I have done so far:

- Created custom formula field on the Case Object for the AssetId (Asset_ID__c)
- Created an Apex Class:
public class CaseRelatedCasesExtension {

    public CaseRelatedCasesExtension(ApexPages.StandardController controller) {

    }


    public list<Case> cases {get;set;}

    public CaseRelatedCasesExtension(){
        cases  = [select id, assetid, accountid, CaseNumber, OwnerId from case Where Asset.Id='AssetId'];
    }
}
- Created a Visualforce Page:
<apex:page standardController="Case" extensions="CaseRelatedCasesExtension">
    <apex:form >
        <apex:pageBlock >
            Case Related Emails
                <apex:PageBlockTable value="{!case}" var="case">
                    <apex:column width="10%">
                        <apex:commandLink value="View" onclick="window.open('/{!case.Id}');"/>
                    </apex:column>
                    <apex:column width="80%" value="{!case.Subject}" />
                    <apex:column width="10%" value="{!case.CaseNumber}"/>
                </apex:pageBlockTable>
        </apex:pageBlock>  
    </apex:form>
</apex:page>

Currently, all that this is showing is the current case, not all cases for that asset.

Sorry if I'm just being an idiot, I'm very new to Apex Classes and Visualforce!

Thanks,
Oli
Hi There!

I have a custom object (Contract Loan) which is related to the Case object, and I'd like to be able to count how many Contract Loan records there are related to each case.
I can't use a ROLLUP Summary, because we don't have (don't want) a Master-Detail Relationship field on the Contract Loan object to the case, so it'd need to be done by an APEX Trigger - I won't lie, I have no idea what I'm doing.

Can anyone give me a hand at starting this, please?

Thanks,
Oli
Hi,

I have a requirement to create an OnClick JavaScript button which will essentially check whether the value of a field (Total Number of Contract Loans on Case) is greater than 1, if it is greater than 1, display an error message (alert), telling the user that there is more than one contract loan record raised against the case.
If the value is not greater than 1 (else), tick a checkbox field on the case (Replacement_Device_Issued__c).

I've tried the below script, but I'm getting a "Unexpected End of Script" error when trying to use it.
 
if('{Case.Total_Number_of_Contract_Loans_on_Case__c}' >1)
{
alert( "More than one contract loan." ))
}
else if('{Case.Total_Number_of_Contract_Loans_on_Case__c}' ==1)
{
var newRecords = []; 
var c = new sforce.SObject(Case); 
c.id ="{Case.Id}"; 
c.Replacement_Device_Issued__c = true;
newRecords.push(c); 
result = sforce.connection.update(newRecords); 
window.location.reload();
}

Any help greatly appreciated!

Thanks,
Oli
Hi there!

I'm looking for a way to automatically close a record tab in Salesforce Service Console when I create a new record.

I'm using a custom object called Configuration Resource(s), these are added to the parent record (Configuration object), from a related list on the Configuration object page layout.
Ideally, I need to be able to have the tab that opens when the new configuration resource is created, close after saving, is this possible?
Hey Guys,

I've recently realised that workflow rules aren't triggered by formula fields, which makes perfect sense now that I've read into it.
I have a need to send an automatic email based on a formula field value as below:

When a 'Repair' record has spent 2 days in one location, I need to send an email to the case owner and case team, to implement this, so far, I've created two new fields on the repair object - 1) Last Moved Date, 2) Days Since Moved.
I've then created a process within process builder that says when the asset location 'ISCHANGED', to update the field value with 'TODAY()' - this works.
I had then created a formula field (days since moved - TODAY() - Asset_Last_Moved__c), and then a workflow rule that said when the value of that field equals 2,4,6,8,10,12 etc etc (I want it to send an email for every two days that the asset spends in one location), it needs to send an email - this works - when the record is edited manually.
Now I know that workflows aren't triggered by formula fields as the data within the formula field as it's displayed isn't actually stored anywhere, so it's not actually modified - this won't work for my use case.

I'm just wondering if anyone else has any recommendations as to how I could approach this? I've thought of making the field 'Days Since Moved' a standard number field, and then having a workflow rule to update that field value as it would then be stored in the database, but even then, the workflow needs to trigger every day, and to set time based actions for this would take a while and it's not really ideal.

Any help really appreciated :) and Happy New Year to you all!

Thanks,
Oli
Hey Guys,

I've recently created two new fields within a custom object (repair) to track the number of days since an asset undergoing repair changes location.
The two fields are:
- Asset Last Moved (Date/Time) 
- Days since Asset Moved (Formula: TODAY() - Asset_Last_Moved__c)

I then have a process in place which checks repair records when they're edited with the following criteria/formula:
ISCHANGED(Asset_Location__c)

Then when the asset location is changed, it puts TODAY() in the Asset Last Moved field.
The formula then updates the value of Days Since Asset Moved to "0", as expected.
I then have another process which checks the value of Days Since Asset Moved, and every two days that it spends in one location, an email will be sent to the case owner and the engineer - this works fine.
The issue I'm facing is that when an asset is in one location for say 2 days, and then it's moved to another location, for some reason, even though the days since last moved field is updated to "0", it still continues to send an email to the engineer and the case owner saying it's been in the same location for the amount of time that it was there prior to changing the asset location.
Apologies if that doesn't make much sense, I'm struggling to find a simpler way to word what's happening here - I'm assuming it's to do with Salesforce not 'waiting' before sending the email after the record is edited?

Any help would be greatly appreciated.

Thanks,
Oli
Hey Guys,

I'm currently working on adding a field to a custom object (Repair) that will display the time since the last change/modification of a certain field within the Repair object (Asset Location).
Similar to Last Modified Date/Time, but field specific, if that makes sense?

So essentially what I'm wanting to use this for, is when a repair spends a certain amount of time with the asset sat in a particular location, an email alert is sent to the team leader and case owner.

Thanks in advance for any help!

Oli
Hi,

I'm trying to complete the challenge on the Creating Object-Specific Quick Actions unit in this trail, but I've come across an issue in my Developer Edition environment and was wondering if anyone could help out here.
I'm trying to create an object-specifc update action, but 'Update a Record' isn't available in my dropdown list when creating global actions - see screenshot below:

User-added image

Any help would be greatly appreciated!
Hi there,

I'm trying to create a list button (OnClick JavaScript), to tick a checkbox on a record from a related list on a case.
I'm wanting to tick a checkbox on a custom object (Contract Loan) which is related to the Case object, without having to go on the record page itself. 

So far, I've written this:
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 
var newRecords = []; 
var c = new sforce.SObject('Contract_Loan__c'); 
c.id ='{!Contract_Loan__c.Id}'; 
c.MSC_Replacement_Device__c ='True'; 
newRecords.push(c); 
var result = sforce.connection.update([c]);

This works for a detail page button on the object page layout, but not a list button, it just doesn't do anything.

Any help greatly appreciated.

Thanks,
Oli
Hello,

I'm trying to create a VF page which will appear on the Case page layout displaying all other cases for the asset on that particular case - here's what I have done so far:

- Created custom formula field on the Case Object for the AssetId (Asset_ID__c)
- Created an Apex Class:
public class CaseRelatedCasesExtension {

    public CaseRelatedCasesExtension(ApexPages.StandardController controller) {

    }


    public list<Case> cases {get;set;}

    public CaseRelatedCasesExtension(){
        cases  = [select id, assetid, accountid, CaseNumber, OwnerId from case Where Asset.Id='AssetId'];
    }
}
- Created a Visualforce Page:
<apex:page standardController="Case" extensions="CaseRelatedCasesExtension">
    <apex:form >
        <apex:pageBlock >
            Case Related Emails
                <apex:PageBlockTable value="{!case}" var="case">
                    <apex:column width="10%">
                        <apex:commandLink value="View" onclick="window.open('/{!case.Id}');"/>
                    </apex:column>
                    <apex:column width="80%" value="{!case.Subject}" />
                    <apex:column width="10%" value="{!case.CaseNumber}"/>
                </apex:pageBlockTable>
        </apex:pageBlock>  
    </apex:form>
</apex:page>

Currently, all that this is showing is the current case, not all cases for that asset.

Sorry if I'm just being an idiot, I'm very new to Apex Classes and Visualforce!

Thanks,
Oli
Hi There!

I have a custom object (Contract Loan) which is related to the Case object, and I'd like to be able to count how many Contract Loan records there are related to each case.
I can't use a ROLLUP Summary, because we don't have (don't want) a Master-Detail Relationship field on the Contract Loan object to the case, so it'd need to be done by an APEX Trigger - I won't lie, I have no idea what I'm doing.

Can anyone give me a hand at starting this, please?

Thanks,
Oli
Hi there!

I'm looking for a way to automatically close a record tab in Salesforce Service Console when I create a new record.

I'm using a custom object called Configuration Resource(s), these are added to the parent record (Configuration object), from a related list on the Configuration object page layout.
Ideally, I need to be able to have the tab that opens when the new configuration resource is created, close after saving, is this possible?
Hey Guys,

I've recently realised that workflow rules aren't triggered by formula fields, which makes perfect sense now that I've read into it.
I have a need to send an automatic email based on a formula field value as below:

When a 'Repair' record has spent 2 days in one location, I need to send an email to the case owner and case team, to implement this, so far, I've created two new fields on the repair object - 1) Last Moved Date, 2) Days Since Moved.
I've then created a process within process builder that says when the asset location 'ISCHANGED', to update the field value with 'TODAY()' - this works.
I had then created a formula field (days since moved - TODAY() - Asset_Last_Moved__c), and then a workflow rule that said when the value of that field equals 2,4,6,8,10,12 etc etc (I want it to send an email for every two days that the asset spends in one location), it needs to send an email - this works - when the record is edited manually.
Now I know that workflows aren't triggered by formula fields as the data within the formula field as it's displayed isn't actually stored anywhere, so it's not actually modified - this won't work for my use case.

I'm just wondering if anyone else has any recommendations as to how I could approach this? I've thought of making the field 'Days Since Moved' a standard number field, and then having a workflow rule to update that field value as it would then be stored in the database, but even then, the workflow needs to trigger every day, and to set time based actions for this would take a while and it's not really ideal.

Any help really appreciated :) and Happy New Year to you all!

Thanks,
Oli
Hey Guys,

I've recently created two new fields within a custom object (repair) to track the number of days since an asset undergoing repair changes location.
The two fields are:
- Asset Last Moved (Date/Time) 
- Days since Asset Moved (Formula: TODAY() - Asset_Last_Moved__c)

I then have a process in place which checks repair records when they're edited with the following criteria/formula:
ISCHANGED(Asset_Location__c)

Then when the asset location is changed, it puts TODAY() in the Asset Last Moved field.
The formula then updates the value of Days Since Asset Moved to "0", as expected.
I then have another process which checks the value of Days Since Asset Moved, and every two days that it spends in one location, an email will be sent to the case owner and the engineer - this works fine.
The issue I'm facing is that when an asset is in one location for say 2 days, and then it's moved to another location, for some reason, even though the days since last moved field is updated to "0", it still continues to send an email to the engineer and the case owner saying it's been in the same location for the amount of time that it was there prior to changing the asset location.
Apologies if that doesn't make much sense, I'm struggling to find a simpler way to word what's happening here - I'm assuming it's to do with Salesforce not 'waiting' before sending the email after the record is edited?

Any help would be greatly appreciated.

Thanks,
Oli
Hey Guys,

I'm currently working on adding a field to a custom object (Repair) that will display the time since the last change/modification of a certain field within the Repair object (Asset Location).
Similar to Last Modified Date/Time, but field specific, if that makes sense?

So essentially what I'm wanting to use this for, is when a repair spends a certain amount of time with the asset sat in a particular location, an email alert is sent to the team leader and case owner.

Thanks in advance for any help!

Oli