• cswanson
  • NEWBIE
  • 0 Points
  • Member since 2011
  • Principal Analyst
  • FICO

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies

We have a custom object that uses an auto number field to uniquely identify each record.

 

For a number of internal reasons we have to use sharepoint document libraries to manage attachments.  This policy will never change until SF.com incorporates versions and check in/check out within the content module.

 

Has anybody ever built a custom button that would automatically create a new folder within an existing sharepoint document library.

 

For example:

 

  1. Our custom SF.com object is called "Deal Request", the auto number field is called "DR Number".
  2. Our document library is located at www.test.com\sharepoint\documents  
  3. When a new deal request record is created the user would be able to push a button called "create attachments folder"
  4. Pushing the button would automatically create a new folder in the existing document library:  www.test.com\sharepoint\documents\drnumber  (where dr number is the new number assigned to the new record just created).

Has anyone ever done something like this?  Could you provide any tips or tricks to look for?

 

Thanks in advance.

 

 

We had an outside consultant create a customization for our company and part of the customization included a custom Apex class.

 

Line 17 of this customization is written as

 

        for(OpportunityTeamMember ot:[select id,UserId,User.Name,Opportunity.OwnerId,Opportunity.Owner.Name from OpportunityTeamMember where OpportunityId=:lineItem.OpportunityId and User.Paid_on_Oppty_Sales_Credits__c=TRUE])

 

I need make an update that checks to see what the "Year" of the opporutnity close date is prior to running line 17 of this code.

 

I tried adding

 

IF(YEAR(Opporutnity.CloseDate) >= 2012) before line 17 but I get compile errors (because I know very little about APEX).

Error: Compile Error: Method does not exist or incorrect signature: YEAR(Schema.SObjectField)

 

What I would like to ulitmately do is add the following type of "if" statement to replace line 17 (the SOQL select statement is different depending on the outcome of the close date check).

 

IF(YEAR(Opporutnity.CloseDate) >= 2012)

        for(OpportunityTeamMember ot:[select id,UserId,User.Name,Opportunity.OwnerId,Opportunity.Owner.Name from OpportunityTeamMember where OpportunityId=:lineItem.OpportunityId and User.Paid_on_Oppty_Sales_Credits__c=TRUE])

IF(YEAR(Opporutnity.CloseDate) < 2012)

        for(OpportunityTeamMember ot:[select id,UserId,User.Name,Opportunity.OwnerId,Opportunity.Owner.Name from OpportunityTeamMember where OpportunityId=:lineItem.OpportunityId)

 

Can anybody recommend a solution to getting this added to our existing apex class.  Thank you in advance for any advice.

 

 

I've attached the relevant portion of the existing APEX class below.

 

public with sharing class ProductSalesCredits {
    public List<SalesCreditListItem> salesCredits {get; private set;}
    public OpportunityLineItem lineItem {get; private set;}
    public Opportunity currencyOpp {get; private set;}
    public List<SelectOption> userOptions {get; private set;}
    public Integer deleteIndex {get;set;}
    public Double revenueForecast {get; private set;}
    public Double bookingAmount {get; private set;}
    
    public static final String TYPE_PRIMARY = 'Primary';
    public static final String TYPE_ADDITIONAL = 'Additional';
    
    private List<Sales_Credit__c> creditsToDelete = new List<Sales_Credit__c>();
    
    private ProductSalesCredits(OpportunityLineItem lineItem, List<Sales_Credit__c> credits) {
        this.userOptions = new List<SelectOption>();
        for(OpportunityTeamMember ot:[select id,UserId,User.Name,Opportunity.OwnerId,Opportunity.Owner.Name from OpportunityTeamMember where OpportunityId=:lineItem.OpportunityId and User.Paid_on_Oppty_Sales_Credits__c=TRUE])
            this.userOptions.add(new SelectOption(ot.UserId,ot.User.Name));          
            
        Opportunity o=[select OwnerId,Owner.Name, CurrencyIsoCode from Opportunity where id=:lineItem.OpportunityId];
        currencyOpp = o;
        this.userOptions.add(new SelectOption(o.OwnerId,o.Owner.Name));
        this.lineItem = lineItem;
        this.salesCredits = new List<SalesCreditListItem>();
        for (Integer i=0;i<credits.size();i++) {
            this.salesCredits.add(new SalesCreditListItem(credits[i],i));
        }

 

 

Looking for some help on creating a trigger, I'm new to Saleforce.com and haven't used this type of customization before.  Here's what I need to do....

 

On an opporutnity I need to be able to track the opportunity owner role.  You are unable to do this with a basic formula field because it does not drill down on the owner ID to the additional owner fields.  Per some research, I came across a presentation that was given at Dreamforce this year in their "Formula Magic" session where they state it's a 3 step process to pull this field into an opportunity.  (http://www.slideshare.net/Salesforce/formula-magic)

 

Step 1: Create a custom lookup field to the user object
Step 2: Create a simple trigger upon insert of record or update of Owner field to populate a custom user lookup field
Step 3: Create formula fields for any field on user object based on custom user lookup field

 

I've done step 1 and created a custom lookup field in my opporutnity called "OwnerLookup".  I need help with a sample trigger for step 2 that will populate "OwnerLookup" with the opportunity owner name, that way I can easily do step 3 to pull in the role.

 

Can anybody please provide a sample trigger you feel might work?

 

Thanks in advance!

We have a custom object that uses an auto number field to uniquely identify each record.

 

For a number of internal reasons we have to use sharepoint document libraries to manage attachments.  This policy will never change until SF.com incorporates versions and check in/check out within the content module.

 

Has anybody ever built a custom button that would automatically create a new folder within an existing sharepoint document library.

 

For example:

 

  1. Our custom SF.com object is called "Deal Request", the auto number field is called "DR Number".
  2. Our document library is located at www.test.com\sharepoint\documents  
  3. When a new deal request record is created the user would be able to push a button called "create attachments folder"
  4. Pushing the button would automatically create a new folder in the existing document library:  www.test.com\sharepoint\documents\drnumber  (where dr number is the new number assigned to the new record just created).

Has anyone ever done something like this?  Could you provide any tips or tricks to look for?

 

Thanks in advance.

 

 

We had an outside consultant create a customization for our company and part of the customization included a custom Apex class.

 

Line 17 of this customization is written as

 

        for(OpportunityTeamMember ot:[select id,UserId,User.Name,Opportunity.OwnerId,Opportunity.Owner.Name from OpportunityTeamMember where OpportunityId=:lineItem.OpportunityId and User.Paid_on_Oppty_Sales_Credits__c=TRUE])

 

I need make an update that checks to see what the "Year" of the opporutnity close date is prior to running line 17 of this code.

 

I tried adding

 

IF(YEAR(Opporutnity.CloseDate) >= 2012) before line 17 but I get compile errors (because I know very little about APEX).

Error: Compile Error: Method does not exist or incorrect signature: YEAR(Schema.SObjectField)

 

What I would like to ulitmately do is add the following type of "if" statement to replace line 17 (the SOQL select statement is different depending on the outcome of the close date check).

 

IF(YEAR(Opporutnity.CloseDate) >= 2012)

        for(OpportunityTeamMember ot:[select id,UserId,User.Name,Opportunity.OwnerId,Opportunity.Owner.Name from OpportunityTeamMember where OpportunityId=:lineItem.OpportunityId and User.Paid_on_Oppty_Sales_Credits__c=TRUE])

IF(YEAR(Opporutnity.CloseDate) < 2012)

        for(OpportunityTeamMember ot:[select id,UserId,User.Name,Opportunity.OwnerId,Opportunity.Owner.Name from OpportunityTeamMember where OpportunityId=:lineItem.OpportunityId)

 

Can anybody recommend a solution to getting this added to our existing apex class.  Thank you in advance for any advice.

 

 

I've attached the relevant portion of the existing APEX class below.

 

public with sharing class ProductSalesCredits {
    public List<SalesCreditListItem> salesCredits {get; private set;}
    public OpportunityLineItem lineItem {get; private set;}
    public Opportunity currencyOpp {get; private set;}
    public List<SelectOption> userOptions {get; private set;}
    public Integer deleteIndex {get;set;}
    public Double revenueForecast {get; private set;}
    public Double bookingAmount {get; private set;}
    
    public static final String TYPE_PRIMARY = 'Primary';
    public static final String TYPE_ADDITIONAL = 'Additional';
    
    private List<Sales_Credit__c> creditsToDelete = new List<Sales_Credit__c>();
    
    private ProductSalesCredits(OpportunityLineItem lineItem, List<Sales_Credit__c> credits) {
        this.userOptions = new List<SelectOption>();
        for(OpportunityTeamMember ot:[select id,UserId,User.Name,Opportunity.OwnerId,Opportunity.Owner.Name from OpportunityTeamMember where OpportunityId=:lineItem.OpportunityId and User.Paid_on_Oppty_Sales_Credits__c=TRUE])
            this.userOptions.add(new SelectOption(ot.UserId,ot.User.Name));          
            
        Opportunity o=[select OwnerId,Owner.Name, CurrencyIsoCode from Opportunity where id=:lineItem.OpportunityId];
        currencyOpp = o;
        this.userOptions.add(new SelectOption(o.OwnerId,o.Owner.Name));
        this.lineItem = lineItem;
        this.salesCredits = new List<SalesCreditListItem>();
        for (Integer i=0;i<credits.size();i++) {
            this.salesCredits.add(new SalesCreditListItem(credits[i],i));
        }

 

 

I'm just getting into a SF admin seat so I don't have much Apex experience.

 

I want 2 fields in the opportunities object to be updated once a field in a custom object is updated.

 

When the text field in Object 1 (the custom object) is entered as complete, I need two seperate fields in the opportunity object updated.

 

I want status changed to approved and a custom checkbox to go from unchecked to checked.

 

Thanks in advance

Looking for some help on creating a trigger, I'm new to Saleforce.com and haven't used this type of customization before.  Here's what I need to do....

 

On an opporutnity I need to be able to track the opportunity owner role.  You are unable to do this with a basic formula field because it does not drill down on the owner ID to the additional owner fields.  Per some research, I came across a presentation that was given at Dreamforce this year in their "Formula Magic" session where they state it's a 3 step process to pull this field into an opportunity.  (http://www.slideshare.net/Salesforce/formula-magic)

 

Step 1: Create a custom lookup field to the user object
Step 2: Create a simple trigger upon insert of record or update of Owner field to populate a custom user lookup field
Step 3: Create formula fields for any field on user object based on custom user lookup field

 

I've done step 1 and created a custom lookup field in my opporutnity called "OwnerLookup".  I need help with a sample trigger for step 2 that will populate "OwnerLookup" with the opportunity owner name, that way I can easily do step 3 to pull in the role.

 

Can anybody please provide a sample trigger you feel might work?

 

Thanks in advance!