• Chris Shade
  • NEWBIE
  • 93 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 27
    Replies

I have a business scenario that I’m having problems designing a solution for.  I have four custom objects that I'm using to track assignment of toll passes to vehicles and record toll transactions for those passes:

vehicle__c
toll_pass__c
vehicle_to_pass_assignment __c (fields: vehicle_ID, toll_pass_ID)
toll_transactions__c (fields: toll_pass, transaction_date, transaction_amount)
 
The scenario I'm trying to allow for is that a particular toll pass may be assigned to more than one vehicle during a given time frame (say a month).  I have to be able to import the transaction history for a given toll pass over that time frame and generate a report by vehicle that lists all the transactions for all the passes that were assigned to that vehicle over that time frame.
 
I'm not quite sure how to approach this schema wise, some options I'm considering:

1) Add an effective start and end date field to each record in vehicle_to_pass_assignment and write triggers to end date the applicable record when a device is re-assigned to a different vehicle). Then develop a report that lists all the transactions that were attributed to that vehicle during the reporting time frame by querying the vehicle_to_pass_assignment object.
 
2) Eliminate the vehicle_to_pass_assignment object and make the toll_pass a lookup relationship on the vehicle object and then use historical field tracking to try to generate the correct report by using the transaction date and the vehicle to toll pass relationship history to correctly group the transactions by vehicle.
 
3) A variant of #1 or #2: Add vehicle lookup relationship field to the toll_transaction object and develop some sort of custom import that finds the correct vehicle to toll pass assignment by either querying the vehicle to device relationship field history or the vehicle_to_pass_assignment object.

I'm not sure if any or all of the options above are techincally possible  or preferable or what the level of difficulty would be for any of them.  I would appreciate any advice or to be pointed to someone whose tackled a similiar problem.  I'm not even sure how to search for this type of scenario; at a previous company we called this concept "date spanning" and used SQL server as our platform - I don't know if there's a comparible or more correct term in the force.com vernacular.

Thanks,

David

I'm trying to apply some changes to a formula field and can't seem to get it to work. This is my first time working with anything like this, so I'm a little outside my comfort zone. Any help or suggestions are appreciated. 

Basically, I have a formula field that returns "Yes" or "No" based on the parameters below:

IF(
OR(
ROUND(TODAY()-At_Firm_Since__c,0)>=2000,
AND(
ABS(ROUND(Broker_since__c-At_Firm_Since__c,0))<180,
ROUND(TODAY()-Broker_since__c,0)<=1825
),
ISBLANK(Broker_since__c),
ISBLANK(At_Firm_Since__c),
AND(CONTAINS(Employing_Firm__c,"UBS"),At_Firm_Since__c=DATE(2007,2,9)),
AND(CONTAINS(Employing_Firm__c,"Raymond James"),At_Firm_Since__c=DATE(2013,2,13)),
AND(CONTAINS(Employing_Firm__c,"Stifel"),At_Firm_Since__c=DATE(2007,4,24)),
AND(CONTAINS(Employing_Firm__c,"Stifel"),At_Firm_Since__c=DATE(2007,7,10)),
AND(CONTAINS(Employing_Firm__c,"Stifel"),At_Firm_Since__c=DATE(2007,7,31)),
AND(CONTAINS(Employing_Firm__c,"Stifel"),At_Firm_Since__c=DATE(2007,8,21)),
AND(CONTAINS(Employing_Firm__c,"Wells Fargo"),At_Firm_Since__c=DATE(2007,10,11)),
AND(CONTAINS(Employing_Firm__c,"Wells Fargo"),At_Firm_Since__c=DATE(2008,1,1)),
AND(CONTAINS(Employing_Firm__c,"Merrill Lynch"),At_Firm_Since__c=DATE(2009,1,1)),
AND(CONTAINS(Employing_Firm__c,"Merrill Lynch"),At_Firm_Since__c=DATE(2009,2,20)),
AND(CONTAINS(Employing_Firm__c,"Morgan Stanley Smith Barney"),At_Firm_Since__c=DATE(2009,6,1)),
AND(CONTAINS(Employing_Firm__c,"UBS"),At_Firm_Since__c=DATE(2009,9,18)),
AND(CONTAINS(Employing_Firm__c,"UBS"),At_Firm_Since__c=DATE(2009,9,19)),
AND(CONTAINS(Employing_Firm__c,"UBS"),At_Firm_Since__c=DATE(2010,1,1)),
AND(CONTAINS(Employing_Firm__c,"Merrill Lynch"),At_Firm_Since__c=DATE(2009,10,23)),
AND(CONTAINS(Employing_Firm__c,"RBC"),At_Firm_Since__c=DATE(2009,03,13)),
AND(CONTAINS(Employing_Firm__c,"RBC"),At_Firm_Since__c=DATE(2009,10,09)),
AND(CONTAINS(Employing_Firm__c,"Barclays")),
AND(CONTAINS(Employing_Firm__c,"J.P. Morgan"))
),
"Yes","No")

All I want to do is include something that will return "No" if the "Employing Firm" field contains "Edward Jones". Is there any way to include that in here? I feel like it should be an easy thing to add, but I'm not having any luck over here. 

I really appreciate any help someone can provide. Thanks!
I have an external source writing batches of variable sizes but up to 200 tasks into SalesForce.  Each time it writes I want to start a single trigger/workflow/flow (I'm flexiable). 

The each of the tasks meet my criteria and each is starting its own apex triggers and I hit limits.

Any ideas how I can get around this?
We have a custom field called Unique Email that is enforced to be unique.  This field is populated by a apex trigger that runs before inserting/updating.  I'm trying to use try/catch to take an alternate action if this error is experienced but the catch doesn't seem to be happening:

User-added image

Here is my code:

trigger uniqueEmail on Contact (before insert, before update) {

        for (Contact c : Trigger.new) {  
            try{
                c.Unique_Email__c = c.Email;
            }
          
            catch(Exception a){
                system.debug(c.id);
                c.Unique_Email__c = NULL;
                List<Contact> contactList = new list<Contact>();
                contactList = [SELECT Id,Email,Remove__c
                                    FROM Contact
                                    WHERE email = :c.Email AND id != :c.id
                                    LIMIT 100];
            
                for(Contact updateContact : contactList)
                {
                    updateContact.Remove__c = FALSE;
                    update updateContact;
                }
                if(c.id==Null){
                    c.Unique_Email__c = NULL;
                    Delete c;
                }
                else{
                    for(Contact cOld : trigger.old){
                        c.Unique_Email__c = NULL;
                    }
                    
                }
                //insert email code
            }
        }
    
}


 

I'm trying to figure out how to export deleted records using either Dataloader.io, Workbench, or the Developer Console.  

I can't figure it out. 

 

I was interested in building an APEX trigger that would allow me to automatically add contacts fromm Data.com.  I couldn't find any examples on this forum so I opened a case and Gage Hudson (Sr. Technical Engineer) was kind enough to give me an example.  Anyways, I wanted to share in case anyone else has a similar interest.



public class SearchController {
    public Boolean isError;
    public Boolean showAccount;

    @TestVisible private String query = 'None';
    @TestVisible private String errorMsg = 'No Error Message';
    @TestVisible private String purchaseFlowOutput = '';
    @TestVisible private Map<String, DCC> currentPage;
    @TestVisible private String newA; // String ID of newly created account for display

    @TestVisible private String currentId;

    @TestVisible private Map<String, String> inputMap = new Map<String, String>();

    public SearchController () {
        Map<String, DCC> currentPage = new Map<String, DCC>();
        isError = false;
        showAccount = false;
    }

    public void searchCompanies() {
        errorMsg = 'No Error Message'; // Reset error message for new search

        query = buildQuery();

        if (query != null) {
            currentPage = execQuery(query);
            checkDupe();
        } else {
            query = 'None'; // Reset Query if not going to run
        }
    }

    @TestVisible private String buildQuery() {
        String s = 'SELECT AnnualRevenue, City, CompanyId, Country, Description, DunsNumber, Fax, Industry, NaicsCode, ' +
            'NaicsDesc, Name, NumberOfEmployees, Ownership, Phone, Sic, SicDesc, Site, State, Street, TickerSymbol, TradeStyle, Website, ' +
            'YearStarted, Zip';
        s = s + ' FROM DatacloudCompany';
        s = s + ' WHERE ';

        boolean firstHit = false; // Change to false on first hit to add AND to rest
        Set<String> regexMatchField = new Set<String>{'Name', 'Website', 'Zip'};

        for (String key : inputMap.keySet()){
            // Make sure that field has a value
            if (inputMap.get(key) != null && !inputMap.get(key).trim().equals('')) {
                if (firstHit)
                    s = s + ' AND ';

                if (regexMatchField.contains(key) )
                    s = s + String.escapeSingleQuotes(key) + ' LIKE \'%' + String.escapeSingleQuotes(inputMap.get(key)) + '%\'';
                else
                    s = s + String.escapeSingleQuotes(key) + ' = \'' + String.escapeSingleQuotes(inputMap.get(key)) + '\'';

                firstHit = true;
            }
        }
        s = s + ' LIMIT 20';
        query = s;
        System.debug('Query string set as : ' + query);

        if (!firstHit) {
            System.debug('No inputs found - firstHit = false');
            return null;
        }

        return s;
    }

    @TestVisible private Map<String, DCC> execQuery(String q) {
        List<DatacloudCompany> results = new List<DatacloudCompany>();
        Map<String, DCC> res = new Map<String, DCC>();
        try {
            results = Database.query(q);

            System.debug('Query successful');

            for (DatacloudCompany c : results) {
                res.put(c.CompanyId, new DCC(c));
            }
        } catch (exception e) {
            isError = true;
            System.debug('Error during execution of query caught');
        }
        return res;
    }

    @TestVisible private void checkDupe() {
        ID userId = UserInfo.getUserId();
        List<Account> accts = [SELECT Jigsaw, ID FROM Account WHERE Jigsaw IN :currentPage.keySet()];
        for(Account a : accts) {
            DCC dc = currentPage.get(a.Jigsaw);
            dc.setRenderBox('false');
            dc.setAccountId(a.ID);
            currentPage.put(dc.getId(), dc);
        }
    }

    @TestVisible private Set<String> getSelectedDDCIds(){
        Set<String> ddcIds = new Set<String>();
        for (DCC c : currentPage.values()) {
            if (c.getSelected().compareTo('true')==0 && c.getHasLink().compareTo('true')!=0)
                ddcIds.add(c.getId());
        }

        return ddcIds;
    }

    public PageReference purchaseAccountDetails() { // Method invoked by VF to purchase details
        if (currentPage == null || currentPage.size() == 0) {
            return null;
        }

        String id;
        DatacloudCompany dcTemp;

        Set<String> ddcIds = getIdsThatRequirePurchase(getSelectedDDCIds());

        if (ddcIds.size() > 0) {
            purchase(ddcIds);
        }

        purchaseFlowOutput = 'Company purchase successful!';
        return null;
    }

    private Set<String> getIdsThatRequirePurchase(Set<String> ddcIds){
        // query the list of owned entity ids, and add them to a set.
        Set<String> ownedEntityIds = new Set<String>();
        for (DatacloudOwnedEntity ownedEntity : [SELECT DataDotComKey from DatacloudOwnedEntity
                                                 WHERE DataDotComKey in :ddcIds]){
            ownedEntityIds.add(ownedEntity.DataDotComKey);
        }

        // iterate over the list of ddc ids and add them a new set if they are not found.
        Set<String> returnSet = new Set<String>();
        for (String ddcId : ddcIds){
            if (!ownedEntityIds.contains(ddcId)){
                returnSet.add(ddcId);
            }
        }
        return returnSet;
    }

    @TestVisible public PageReference createAccount() {
        // Filter ids that already have accounts
        Set<String> ddcIdsForAccounts = getSelectedDDCIds();
        Set<String> ddcIdsThatRequirePurchase = getIdsThatRequirePurchase(ddcIdsForAccounts);

        if (ddcIdsThatRequirePurchase.size() > 0){
            purchaseFlowOutput = 'Account creation failed because some details have not been purchased';
            return null;
        }

        List<DatacloudCompany> dcTemp = searchIds(ddcIdsForAccounts);
        List<Account> accts = new List<Account>();

        if (dcTemp != null)
            createAccounts(dcTemp);

        purchaseFlowOutput = 'Account successfully created!';
        return null;
    }

    @TestVisible private Boolean purchase(Set<String> DDCids) {
        DatacloudPurchaseUsage pu = new DatacloudPurchaseUsage(DatacloudEntityType='1',
                                                               Description='Added via search-before-create Account Tool');

        try {
            insert pu;
        } catch (Exception e) {
            System.debug('Error when inserting purchase usage object');
            return false;
        }

        List<DatacloudOwnedEntity> ownedEntities = new List<DatacloudOwnedEntity>();

        for (String ddcId : ddcIds){
            ownedEntities.add(new DatacloudOwnedEntity(PurchaseUsageId = pu.id,
                                                       DataDotComKey = ddcId,
                                                       DatacloudEntityType = '1'));
        }

        try {
            insert ownedEntities;
        } catch (DMLException e){
            System.debug('Error when inserting owned entities');
            return false;
        }
        return true;
    }

    private List<DatacloudCompany> searchIds(Set<String> ddcIds) {
        List<DatacloudCompany> ddcCompany = new List<DatacloudCompany>();
        Integer size  = ddcIds.size();
        try {
            ddcCompany = [SELECT AnnualRevenue, City, CompanyId, Country, Description, DunsNumber,
                          Fax, Industry, NaicsCode, NaicsDesc, Name, NumberOfEmployees,
                          Ownership, Phone, Sic, SicDesc, Site, State, Street, TickerSymbol,
                          TradeStyle, Website, YearStarted, Zip FROM DatacloudCompany WHERE
                          CompanyId in :ddcIds limit :size];

            return ddcCompany;
        } catch (exception e) {
            isError = true;
            System.debug('Error during execution of query was caught');
        }

        return null; // Clearly an Error Occured
    }


    private String createAccounts(List<DatacloudCompany> ddcCompanies) {
        Map<String, Account> accountMap = new Map<String, Account>();
        for (DatacloudCompany dc : ddcCompanies){
            accountMap.put(dc.CompanyId, new Account(AccountSource='Data.com', AnnualRevenue=dc.AnnualRevenue,
                                                     BillingCity=dc.city, ShippingCity=dc.city, Jigsaw=dc.CompanyId, BillingCountry=dc.Country,
                                                     ShippingCountry=dc.Country, Description=dc.Description, DunsNumber=dc.DunsNumber,
                                                     Fax=dc.Fax, Industry=dc.Industry, NaicsCode=dc.NaicsCode, NaicsDesc=dc.NaicsDesc,
                                                     Name=dc.Name, NumberOfEmployees=dc.NumberOfEmployees, Ownership=dc.Ownership,
                                                     Phone=dc.Phone, Sic=dc.Sic, SicDesc=dc.SicDesc, Site=dc.Site, BillingState=dc.State,
                                                     ShippingState=dc.State, BillingStreet=dc.Street, ShippingStreet=dc.Street,
                                                     TickerSymbol=dc.TickerSymbol, Tradestyle=dc.TradeStyle, Website=dc.Website,
                                                     YearStarted=dc.YearStarted, BillingPostalCode=dc.Zip, ShippingPostalCode=dc.Zip));
        }

        if (accountMap.size() > 0) {
            insert accountMap.values();
        }

        for (String ddcId : accountMap.keySet()) {
            DCC dcc = currentPage.get(ddcId);
            dcc.setAccountId(accountMap.get(ddcId).id);
            dcc.setRenderBox('false');
        }
        return null;
    }

    // Used by the tests to reset the input map
    @TestVisible private void resetInputMap(){
        inputMap = new Map<String, String>();
    }

    @TestVisible public Boolean getHaveResults() {
        return (currentPage != null && currentPage.size() > 0)?  true : false;
    }

    public PageReference returnToPage() {
        return null;
    }

    /* ---------- Getters and Setters ---------- */

    /* --- Below here are getters and setters for the VisualForce Page --- */
    public Map<String, DCC> getCurrentPage() {
        return currentPage;
    }
    public String getInputCompanyName() {
        return inputMap.get('Name');
    }
    public void setInputCompanyName(String value) {
        inputMap.put('Name', value);
    }
    public String getInputCity() {
        return inputMap.get('City');
    }
    public void setInputCity(String value) {
        inputMap.put('City', value);
    }
    public String getInputCountry() {
        return inputMap.get('Country');
    }

    public void setInputCountry(String value) {
        inputMap.put('Country', value);
    }
    public String getInputPostalCode() {
        return inputMap.get('Zip');
    }
    public void setInputPostalCode(String value) {
        inputMap.put('Zip', value);
    }
    public Boolean getShowAccount() {
        return showAccount;
    }
    public Boolean getIsError() {
        return isError;
    }
    public void setIsError(Boolean value) {
        this.isError = value;
    }
    public String getErrorMsg() {
        return errorMsg;
    }
    public String getQuery() {
        return query;
    }
    public String getPurchaseFlowOutput() {
        return purchaseFlowOutput;
    }
    /* ---------- Custom Class ---------- */

    public class DCC {
        private DatacloudCompany comp;
        private String selected;
        private String renderBox;
        private String accountId;
        private String companyId;

        public DCC(DatacloudCompany item) {
            this.comp = item;
            this.selected = 'false';
            this.renderBox = 'true';
            this.accountId = null;
            companyId = item.companyId;
        }

        public String getLink() {
            if (accountId == null){
                return '';
            }
            return '<a href="'+ System.URL.getSalesforceBaseUrl().toExternalForm() + '/' + accountId + '" > Account </a>';
        }

        public String getHasLink() {
            if (accountId != null){
                return 'true';
            }
            return 'false';
        }
        public String getAccountId() {
            return accountId;
        }
        public void setAccountId(String value) {
            this.accountId = value;
        }
        public DatacloudCompany getComp() {
            return comp;
        }
        public String getSelected() {
            if (accountId != null){
                return 'true';
            }
            return selected;
        }
        public void setSelected(String value) {
            this.selected = value;
        }
        public String getRenderBox() {
            return renderBox;
        }
        public void setRenderBox(String value) {
            this.renderBox = value;
        }
       
        @TestVisible private void setId(String companyId){
            this.companyId = companyId;
        }
        public String getId() {
            return companyId;
        }
        public String getTickerSymbol() {
            return comp.TickerSymbol;
        }
        public String getName() {
            return comp.Name;
        }
        public String getCity() {
            return comp.City;
        }
        public String getCountry() {
            return comp.Country;
        }
        public String getPhone() {
            return comp.Phone;
        }
        public String getIndustry() {
            return comp.Industry;
        }
        public String getSite() {
            return comp.Site;
        }
    }
}
Hi,
I'm trying to create a formula field to round up to either 1.00 or 1.50 or 2.00 or 3.00.  There will not ever be anything over 
The formula field is as follows: ROUND(X10Min_ofHours__c + X15Min_ofHours__c + X20Min_ofHours__c + X45Min_ofHours__c,1)

These are driven by products selected and rounds into minutes.  Example of roll-up: if .80, then it should display 1.00, and if 1.10, than it should show up as 1.50 and if it shows 1.60, it should show as 2.00 and if it shows 2.10 or anything over, it will all round up/down to 3.00  So it's a roundup.  How can I configure this formula field.
Hi - hope somebody can give an idea how to get this done. 

We have a custom object "Program Enrollment" and a related list or object called " Outcomes". We need to create reports where we can pull the first and last outcome entries, but we don’t think creating an extra field (check box or drop down) in the outcomes object to flag the first and last outcome is the best approach. And correct me if I am wrong. 

Is there a way to pull the first and last record of a related table somehow? And being able to display those 2 values in the "program Enrollment" parent object in fields? So they can then be pulled out in reports. 

User-added image

 
I currently have a date field "Invoice 1" and a formula field "Invoice Created Date" - the formula field is simple - "Invoice 1" - 30 to set the created date as 30 days before the due date of the invoice... however we need to make sure the Invoice created date does not get set for dates in the past.. how do I create a formula that says..if the Invoice 1 date is less than 30 days set as today else set as - 30?
We have a custom field called Unique Email that is enforced to be unique.  This field is populated by a apex trigger that runs before inserting/updating.  I'm trying to use try/catch to take an alternate action if this error is experienced but the catch doesn't seem to be happening:

User-added image

Here is my code:

trigger uniqueEmail on Contact (before insert, before update) {

        for (Contact c : Trigger.new) {  
            try{
                c.Unique_Email__c = c.Email;
            }
          
            catch(Exception a){
                system.debug(c.id);
                c.Unique_Email__c = NULL;
                List<Contact> contactList = new list<Contact>();
                contactList = [SELECT Id,Email,Remove__c
                                    FROM Contact
                                    WHERE email = :c.Email AND id != :c.id
                                    LIMIT 100];
            
                for(Contact updateContact : contactList)
                {
                    updateContact.Remove__c = FALSE;
                    update updateContact;
                }
                if(c.id==Null){
                    c.Unique_Email__c = NULL;
                    Delete c;
                }
                else{
                    for(Contact cOld : trigger.old){
                        c.Unique_Email__c = NULL;
                    }
                    
                }
                //insert email code
            }
        }
    
}


 
In my email I'm trying to display various fields, but only if a certain checkbox is marked. I was able to get the fields to diplay correctly, but I want to create a line break after a field is diplayed on the page.

Here's my code:

<table>
    <apex:repeat var="cx" value="{!relatedTo.OpenActivities}">
    <p><b>Outstanding Requirements:</b> {!cx.Subject}<br></br>
        <b>Follow-up Date: </b> 
              <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
              <apex:param value="{!cx.ActivityDate}" />
              </apex:outputText><br></br>
    <i>
    <apex:outputField value="{!cx.Activity__c}" rendered="{!NOT(cx.Activity_Completed__c)}"/>
    <apex:outputField value="{!cx.Activity1__c}" rendered="{!NOT(cx.Activity1_Completed__c)}"/>
    <apex:outputField value="{!cx.Activity2__c}" rendered="{!NOT(cx.Activity2_Completed__c)}"/>
    <apex:outputField value="{!cx.Activity3__c}" rendered="{!NOT(cx.Activity3_Completed__c)}"/>
    <apex:outputField value="{!cx.Activity4__c}" rendered="{!NOT(cx.Activity4_Completed__c)}"/>
    </i>
    </p>
   </apex:repeat> 
</table>
Hi, I'm trying to grab the Owner information for a custom field "Created By" so I can manipulate it to my heart's content.  However, I'm unable to convert the Owner information in a text forumla field, it simply says that the field doesn't exist.  Is it possible to access the Owner default field in any way so I don't have to have users input that data manually?
Previously I have written some code on a trial site. Unfortunately, the site became production before I had a chance to complete the test code. Now I continue to develop the code on a sandbox but it can't be deployed back to the production site since it keeps saying the code coverage on the production site is lower than 75%. How can I get this fixed and deploy the code?

I have a business scenario that I’m having problems designing a solution for.  I have four custom objects that I'm using to track assignment of toll passes to vehicles and record toll transactions for those passes:

vehicle__c
toll_pass__c
vehicle_to_pass_assignment __c (fields: vehicle_ID, toll_pass_ID)
toll_transactions__c (fields: toll_pass, transaction_date, transaction_amount)
 
The scenario I'm trying to allow for is that a particular toll pass may be assigned to more than one vehicle during a given time frame (say a month).  I have to be able to import the transaction history for a given toll pass over that time frame and generate a report by vehicle that lists all the transactions for all the passes that were assigned to that vehicle over that time frame.
 
I'm not quite sure how to approach this schema wise, some options I'm considering:

1) Add an effective start and end date field to each record in vehicle_to_pass_assignment and write triggers to end date the applicable record when a device is re-assigned to a different vehicle). Then develop a report that lists all the transactions that were attributed to that vehicle during the reporting time frame by querying the vehicle_to_pass_assignment object.
 
2) Eliminate the vehicle_to_pass_assignment object and make the toll_pass a lookup relationship on the vehicle object and then use historical field tracking to try to generate the correct report by using the transaction date and the vehicle to toll pass relationship history to correctly group the transactions by vehicle.
 
3) A variant of #1 or #2: Add vehicle lookup relationship field to the toll_transaction object and develop some sort of custom import that finds the correct vehicle to toll pass assignment by either querying the vehicle to device relationship field history or the vehicle_to_pass_assignment object.

I'm not sure if any or all of the options above are techincally possible  or preferable or what the level of difficulty would be for any of them.  I would appreciate any advice or to be pointed to someone whose tackled a similiar problem.  I'm not even sure how to search for this type of scenario; at a previous company we called this concept "date spanning" and used SQL server as our platform - I don't know if there's a comparible or more correct term in the force.com vernacular.

Thanks,

David

I have been trying to create a contact record once a user record of a specific profile has been created. I am able to save the trigger but cannot create a user record. I have posted a code below. 
trigger createContact on User (before insert) {     
List<Contact> ur = new List<Contact>();
    for (User usr: Trigger.New)
    //IF(Usr.UserRoleId == '00EK0000000KRUR'){
          ur.add (new Contact(
                     FirstName = Usr.FirstName,
                     LastName = Usr.LastName));
                  //  }   
         
   
   insert ur;
 }
  • November 19, 2014
  • Like
  • 1
I have a requirement wherein following needs to be implemented:-

For a particular Opportunity Record Type - 

If there are Opportunity Stages A, B, C, D, E, F Team1 should be able to progress the opp till stage C and also to stage F. They should not be able to progress opp to Stages D, E.

Team2 should be able to progress the opp to all stages.

How can I achieve this functionality? I thought of creating multiple Sales Process but this would require me to create multiple Record Types.
Hi all ,

I have parent - child account relationship. I have created custom object "Account Stages"  which has relationship with account and displayed in related list on account pages . I'm trying to figure out how to ...
1. ONLY allow add/update account stages when the user is on parent account page.
2. Display "Account stages" related list on all child account pages.

Thanks for your help.

 
  • October 29, 2014
  • Like
  • 0
I'm trying to apply some changes to a formula field and can't seem to get it to work. This is my first time working with anything like this, so I'm a little outside my comfort zone. Any help or suggestions are appreciated. 

Basically, I have a formula field that returns "Yes" or "No" based on the parameters below:

IF(
OR(
ROUND(TODAY()-At_Firm_Since__c,0)>=2000,
AND(
ABS(ROUND(Broker_since__c-At_Firm_Since__c,0))<180,
ROUND(TODAY()-Broker_since__c,0)<=1825
),
ISBLANK(Broker_since__c),
ISBLANK(At_Firm_Since__c),
AND(CONTAINS(Employing_Firm__c,"UBS"),At_Firm_Since__c=DATE(2007,2,9)),
AND(CONTAINS(Employing_Firm__c,"Raymond James"),At_Firm_Since__c=DATE(2013,2,13)),
AND(CONTAINS(Employing_Firm__c,"Stifel"),At_Firm_Since__c=DATE(2007,4,24)),
AND(CONTAINS(Employing_Firm__c,"Stifel"),At_Firm_Since__c=DATE(2007,7,10)),
AND(CONTAINS(Employing_Firm__c,"Stifel"),At_Firm_Since__c=DATE(2007,7,31)),
AND(CONTAINS(Employing_Firm__c,"Stifel"),At_Firm_Since__c=DATE(2007,8,21)),
AND(CONTAINS(Employing_Firm__c,"Wells Fargo"),At_Firm_Since__c=DATE(2007,10,11)),
AND(CONTAINS(Employing_Firm__c,"Wells Fargo"),At_Firm_Since__c=DATE(2008,1,1)),
AND(CONTAINS(Employing_Firm__c,"Merrill Lynch"),At_Firm_Since__c=DATE(2009,1,1)),
AND(CONTAINS(Employing_Firm__c,"Merrill Lynch"),At_Firm_Since__c=DATE(2009,2,20)),
AND(CONTAINS(Employing_Firm__c,"Morgan Stanley Smith Barney"),At_Firm_Since__c=DATE(2009,6,1)),
AND(CONTAINS(Employing_Firm__c,"UBS"),At_Firm_Since__c=DATE(2009,9,18)),
AND(CONTAINS(Employing_Firm__c,"UBS"),At_Firm_Since__c=DATE(2009,9,19)),
AND(CONTAINS(Employing_Firm__c,"UBS"),At_Firm_Since__c=DATE(2010,1,1)),
AND(CONTAINS(Employing_Firm__c,"Merrill Lynch"),At_Firm_Since__c=DATE(2009,10,23)),
AND(CONTAINS(Employing_Firm__c,"RBC"),At_Firm_Since__c=DATE(2009,03,13)),
AND(CONTAINS(Employing_Firm__c,"RBC"),At_Firm_Since__c=DATE(2009,10,09)),
AND(CONTAINS(Employing_Firm__c,"Barclays")),
AND(CONTAINS(Employing_Firm__c,"J.P. Morgan"))
),
"Yes","No")

All I want to do is include something that will return "No" if the "Employing Firm" field contains "Edward Jones". Is there any way to include that in here? I feel like it should be an easy thing to add, but I'm not having any luck over here. 

I really appreciate any help someone can provide. Thanks!
I'm struggling with implementing a validation rule based on a record type.  The issue is the status of Closed/Resolved is used across all record types and the validation should only be applied if it is a specific record type.
 
The validation is:
 
It is an error if the case record type is Development and the status is Closed/Resolved, require the Validated Date be required.
 
This is the validation rule I currently have which is being applied on irregardless of record type:
 
AND (
RecordTypeId ="01200000000014WAAQ",
AND(
OR(
ISPICKVAL ( Status , "Closed/Resolved")),
ISNULL ( QAValidatedDate__c )
))AND (
RecordTypeId ="01200000000014WAAQ",
AND(
OR(
ISPICKVAL ( Status , "Closed/Resolved")),
ISNULL ( QAValidatedDate__c )
))
 
Any help/guidance would be much appreciated
 
V-
 
 
  • September 06, 2008
  • Like
  • 0
I'm sure there's a way I can do this, but I'm trying to figure out if there is a way to set the record type of a detail record based on some information in the master record when I create a detail record in a master-detail relationship.

I know that I can do it when the detail record is *saved* through a workflow rule -- but I'd really like to set the record type when I first hit "new" to create a new detail record on the master's page.

Any ideas?  Suggestions?  Best practices?

Thanks,
Michael
All,
 
I'm currently using a "round robin" case assignment method that uses the (Case Number)MOD(Number of Engineers) to determine how to assign the cases.  However, this has multiple flaws - expecially when multiple cases get assigned to one person due to them being for the same customer, then other engineers get "skipped", etc.
 
I want to assign cases base on how many have been assigned for that day.  For example, each engineer will have a "counter" that tracks how many cases were assigned to them that day.  Each case would get assigned to the next engineer in line that has the fewest number of cases assigned to them that day.  If there is a "tie" - meaning all engineers have been assigned the same number of cases that day, then it should default to a secondary rule which just numbers the engineers 1, 2, 3 etch.
 
anyone have ideas on how to accomplish this?  I just want to assign the cases equally per day accross my engineers.
I've setup a custom object to track high level project activities.  These activities can be comprised of one or many tasks (which are using the standard salesforce tasks object) and I'd like to figure out a way to automatically update the total time estimate for this activity.

IE:
Activity: setup activities
 SF Task 1: create item 1 (2 hours)
 SF Task 2: create item 2 (1 hour)

Total time that should show on the main 'setup activities' record would be 3 hours.

I'm not sure how I would go about this or if it would just be better to total this information through a report.