• MandyKool
  • SMARTIE
  • 864 Points
  • Member since 2010

  • Chatter
    Feed
  • 30
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 22
    Questions
  • 283
    Replies
Hi
i m a new admin and a maybe stupid question . 
2 teams in my company (sales and support ) 
I need to create 2  differents opportunity path . Sales must be able to view (not edit) the support's opportunity and vice versa . 

is it possible ? how ? 
I can't get the Pagination piece of the course to work in my preview.  See the code I'm using per the instructions:

<apex:page standardController="Contact" recordSetVar="contacts">
  <apex:form>
    <apex:pageBlock title="Contacts List" id="contacts_list">
        
        Filter:
        <apex:selectList value="{! filterId }" size="1">
            <apex:selectOptions value="{! listViewOptions }"/>
            <apex:actionSupport event="onchange" reRender="contacts_list"/>   
        </apex:selectList>
        
        <!-- Contacts List -->
        <apex:pageblockTable value="{! contacts }" var="ct">
            <apex:column value="{! ct.FirstName }"/>
            <apex:column value="{! ct.LastName }"/>
            <apex:column value="{! ct.Email }"/>
            <apex:column value="{! ct.Account.Name }"/>
            
            <!-- Pagination -->
<table style="width: 100%"><tr>
    <td>
        Page: <apex:outputText 
    value=" {!PageNumber} of {! CEILING(ResultSize / PageSize) }"/>
    </td>            
    <td align="center">
<!-- Previous page -->
<!-- active -->
<apex:commandLink action="{! Previous }" value="« Previous"
     rendered="{! HasPrevious }"/>
<!-- inactive (no earlier pages) -->
<apex:outputText style="color: #ccc;" value="« Previous"
     rendered="{! NOT(HasPrevious) }"/>
&nbsp;&nbsp;  
<!-- Next page -->
<!-- active -->
<apex:commandLink action="{! Next }" value="Next »"
     rendered="{! HasNext }"/>
<!-- inactive (no more pages) -->
<apex:outputText style="color: #ccc;" value="Next »"
     rendered="{! NOT(HasNext) }"/>
    </td>
    
    <td align="right">
        Records per page:
<apex:selectList value="{! PageSize }" size="1">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="20"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>
    </td>
</tr></table>

            
            
            
        </apex:pageblockTable>
    </apex:pageBlock>
  </apex:form>
</apex:page>
Hi,

On the standard Case object, I have a custom checkbox 'displayPageA'. If I check this checkbox and then save the case, I want to open my custom VF page 'PageA' in a new tab. The data on this VF page also depends on the Account name selected on the Case.

I was trying to display this page as a popup window, but it seems too hard to do, so I want to try this way.

Is it possible to do?  How should I go about doing it?
Thanks for helping.
Khanh
 
I've a Custom Settings with Hierarchy, on that two fields Read__c, Unread__c.
integer i=10;
integer j=5;

query1='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+i+') from Account where is_read__C = false';

query2='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+j+') from Account  where is_read__C = true';

The Above Code Snippet Works Good. when we Use Custom Settings Value in not works.
AccountSetting__c acs =AccountSetting__c.getInstance();
integer i=integer.valueOf(acs.Read__c); //Read = 10
integer j=integer.valueOf(acs.Unread__c); //Unread = 20

query1='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+i+') from Account where is_read__C = false';
query2='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+j+') from Account where is_read__C = true';
Thanks in Advance
In my first page I have used getDescribe() function to get all the object of the org & I’m passing that selected object to another page using map where I will get the list of related fields of that object. On another page I have 5 rows as we have in standard workflow for rule criteria
When I’m selecting the field, operator & entering the value & saving it, each row is getting saved as a single record, by appending these fields using formula field example. “accountnumber = 123456” (Formula field of text type).
I’ve created a master detail relationship between the 2 custom objects “Rule” & “Rule Criteria”. The records of the Rule criteria are appearing under the appropriate ‘Rule Name’ related list.
Now my requirement is I need to fetch the records under ‘Rule Name’ one by one & from the object “Rule Criteria” & append them in a single string separating them by AND , example

This is my page 
-----------------------

Object : Account (output label for getting the selected object from the previous page)
Rule Name : My Example Rule (Text Field to enter rule name)
Evaluation Criteria : Record Is Created (Dropdown List)

Field Name             Operator      Value
Account Number       Equals      123456
Email                      Contains      example
Select Field               None
Select Field               None
Select Field               None

Now the records in the object will look like
Record 1
--------------
Rule Name : My Example Rule
Field : accountnumber
Operator : =
Value = 123456
Formula String : accountnumber = 123456

Record 2
--------------
Rule Name : My Example Rule
Field : email
Operator : LIKE \’%{val}%\ (i.e contains)
Value = test
Formula String : email LIKE \’%{val}%\ example

So the query will look like “ String str = select accountnumber, email from account where Record1.formula_string AND Record2.formula _string; “
So how can I get the functionality of the operators selected &
How can I write the string
Please assist

There are lots of rows in this object, but when I run a query from it in a test method, it is not seeing any rows. Why? How am I suppose to test my code if I cannot see the data??

  • April 18, 2012
  • Like
  • 0

I'm having trouble with a field update formula that would strip off the hyphen that is added to the end of the new opportunity name when a lead is converted.  Is it standard for a hyphen to be appended to the Opp name during the convert process?

  • April 18, 2012
  • Like
  • 0

Friends i have written a test class whic pulls the data from object for display information on a visulal foce page.

Class Code is give below.......In this class i m fatching current page id (which is needed to represent information)....after that i have written a Test class....My question is that how i get current page id for this....i have tried somethin but it's not working please check this........I have mentioned test class code also............Imeditely needed...thanks

 

//Origenal class

 

public with sharing class GoogleChart_OpptyStage_Subex_new {

    
  public list<Opportunity> OpptyList{get;set;}
  public list<Opportunity> OpptyList1{get;set;}
  
  public Decimal dropped{get;set;}
  public Decimal closedwon {get;set;}
  public Decimal closedlost {get;set;}
  
  public Decimal UQ{get;set;}
  public Decimal NI{get;set;}
  public Decimal OQ{get;set;}
  public Decimal RFI{get;set;}
  public Decimal RFP {get;set;}
  public Decimal Shortlisted{get;set;}
  public Decimal CN{get;set;}
  public Decimal PO {get;set;}
  
  //public List<Opportunity> opptyList {get;set;}
  
  public GoogleChart_OpptyStage_Subex_new(ApexPages.Standardcontroller controller) {
       OpptyList = new list<Opportunity> ();
       OpptyList1 = new list<Opportunity>();
      //OpptyList1=[select id, StageName,Name,CloseDate From Opportunity where StageName ='Closed Won' ];
      Account acc=[select Id,Name from Account where Id=: Apexpages.currentPage().getParameters().get('Id')];
      opptyList = [select id, StageName, Amount From Opportunity where (StageName ='Stage8: Closed Dropped' OR StageName ='Stage8: Closed Lost' OR StageName ='Stage8: Closed Won') AND AccountId =: acc.Id];
      opptyList1 = [select id, StageName, Amount From Opportunity where StageName !='Stage8: Closed Dropped' AND StageName !='Stage8: Closed Lost' AND StageName !='Stage8: Closed Won'  AND AccountId =: acc.Id];
      dropped = 0;
      closedwon = 0;
      closedlost = 0;
      
      UQ = 0;
      NI = 0;
      OQ = 0;
      RFI = 0;
      Shortlisted = 0;
      CN = 0;
      RFP = 0;
      PO = 0;
      
      for(Opportunity opp : opptyList ){
          if(opp.StageName  =='Stage8: Closed Won') {
            closedwon=closedwon+opp.Amount;    
          }
         if(opp.StageName  =='Stage8: Closed Lost') {
          closedlost=closedlost+opp.Amount;
         }
          if(opp.StageName  =='Stage8: Closed Dropped') {
            dropped=dropped+opp.Amount;  
          }
      }
      for(Opportunity opp1 : opptyList1 ){
          if(opp1.StageName  =='Stage 0: Unqualified / Inactive') {
            UQ=UQ+opp1.Amount;    
          }
          if(opp1.StageName  =='Stage 1: Need Identification') {
          NI=NI+opp1.Amount;
          }
          if(opp1.StageName  =='Stage 2: Opportunity Qualification') {
            OQ=OQ+opp1.Amount;  
          }
          
          if(opp1.StageName  =='Stage 3: RFI / Budgetary Proposal') {
            RFI=RFI+opp1.Amount;    
          }
          if(opp1.StageName  =='Stage 4: RFP / Proposal Evaluation') {
          RFP=RFP+opp1.Amount;
          }
          if(opp1.StageName  =='Stage 5: Shortlist') {
            Shortlisted=Shortlisted+opp1.Amount;  
          }
          if(opp1.StageName  =='Stage 6: Selected / Contract Negotiation') {
            CN = CN+opp1.Amount;  
          }
          if(opp1.StageName  =='Stage7: PO/Contract Under Process') {
            PO=PO+opp1.Amount;  
          }
      }
     }
public string test(){
    System.debug('----------------------------->hiii');
    return null;
}
}

 

 

 

--------------------------------------Test class------------------------------------------------

@isTest
private class TestClassForGoogleChart
{
static testMethod void MethodName()
{
Profile pf = [Select Id from Profile where Name = 'System Administrator'];
User u = new User();
u.FirstName = 'Test';
u.LastName = 'User';
u.Email = 'testuser@test123456789.com';
u.CompanyName = 'test.com';
u.Title = 'Test User';
u.Username = 'testuser@test123456789.com';
u.Alias = 'testuser';
u.CommunityNickname = 'Test User';
u.TimeZoneSidKey = 'America/Mexico_City';
u.LocaleSidKey = 'en_US';
u.EmailEncodingKey = 'ISO-8859-1';
u.ProfileId = pf.Id;
//u.Default_Group__c='All';
u.LanguageLocaleKey = 'en_US';
insert u;
system.runAs(u)
{
Account act = new Account();
act.Name='TestAccount';
act.Market_Unit__c='APAC';
act.Region__c='APAC';
act.Country__c='India';
act.Annual_Revenue__c='$10B+';
act.Rating='Tier 1';
act.Type='Customer';
act.Website='www.kvpcorp.com';
insert act;

Opportunity op = new Opportunity();
op.Name='TestOpp';
op.AccountId=act.Id;
op.Product__c='ROC CR';
op.RVP_Sales__c='Norbert Holst';
op.LeadSource='Advertising';
op.Sales_Channel__c='Direct';
op.Industry_Segments__c='Cable';
op.StageName='Stage 0: Unqualified / Inactive';
op.CloseDate=system.today();
op.ForecastCategoryName='Pipeline';
insert op;


ApexPages.StandardController sc = new ApexPages.StandardController(act);
GoogleChart_OpptyStage_Subex_new GCO = new GoogleChart_OpptyStage_Subex_new(sc );
ApexPages.currentPage().getParameters().put('ID',act.id);





}
}
}


What's the meaning of spring'12 in salesforce, is it the same with the spring framework we used in development?

I am a new learner about force.com, so I have not got some ideas about this? Does anyone can tell me where I can get the information?

 

Please help me, thanks.

Just getting started with unit testing a controller extension and I have found a lot of good tips on this board.  I'm still not so sure I understand a testing pattern I see frequently.  Namely, the creation of the PageReference object.  For example here is a simplified version of my extension

 

public class AppointmentControllerExtension {
    
    private ApexPages.StandardController standardController;
    private final Appointment__c appointment;
    
    public AppointmentControllerExtension (ApexPages.StandardController stdController) {
        this.appointment = (Appointment__c)stdController.getRecord();
        this.standardController = stdController;
     }
     
    public String getStudentName() {
    
        String studentName = 'Not Found';
        
        if (appointment.Student__c != null ) {
            Student__c student = [SELECT First_Name__c, Last_Name__c
                                    FROM Student__c
                                   WHERE Id = :appointment.Student__c];
            if (student != null) {
                studentName = student.First_Name__c + ' ' + student.Last_Name__c; 
            }   
        }
        return studentName;
    
    }
    
}

 And the corresponding test class

 

@istest
public class AppointmentControllerExtensionTest {
          
    public static testmethod void testStudentName() {
        
        String firstName = 'First';
        String lastName  = 'Last';
        Student__c student = new Student__c(First_Name__c = firstname, Last_Name__c = lastName);
        insert student;
        
        Appointment__c appointment = new Appointment__c(Student__c = student.Id); 
        insert appointment;
        
        // Instantiate VisualForce Page - but why?
        
        //PageReference pg = Page.Appt_New;
        //Test.setCurrentPage(pg);
        //ApexPages.currentPage().getParameters().put('id', appointment.id);
        
        // Instantiate custom Controller
        
        ApexPages.StandardController stc = new ApexPages.StandardController(appointment);
        AppointmentControllerExtension ae = new AppointmentControllerExtension(stc);
        
        // Test get method
        
        String studentName = ae.getStudentName();
        System.assertEquals(studentName, firstName + ' ' + lastName);
    
    }
   
}

 

I have commented out the references to PageReference and the test runs just fine.  So...what is it that I am missing when I don't include these three lines?  They must serve a purpose, right?

 

Thanks for any insights you can provide.

Hi All,

 

I just  need to ensure about the workflow

Is it possible to invoke a triiger using a workflow action

 

I tried some what, But i cant able to go further,

Here i was stumped and i need some one assistance to acheive

 

Any help can be appreciated greatly

Thanks

Vinu 

  • April 06, 2012
  • Like
  • 0

Hi,

 

Here is a trigger for generating automatic scheule setoff amount.Trigger is working fine.But when i run the test class it showing error like this  System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AutoSetOff_on_Receipt: execution of AfterInsert caused by: System.TypeException: Invalid double: null Trigger.AutoSetOff_on_Receipt: line 21, column 1: [].


How to resolve this error

 

      List<AggregateResult> groupedResults = [SELECT Sum(Amount__c)aver FROM Receipt__c
                                                Where Opportunity__c =: R.Opportunity__c
                                                AND Realization_Status__c = 'Done'];
       Double TotalReceipt = 0.0 ;
        if(groupedResults.size() > 0)
        {
            String str = '' + groupedResults[0].get('aver') ;
            TotalReceipt = Double.ValueOf(str) ;
            System.debug('TotalReceipt ::::: ' + TotalReceipt) ;
        }


  • April 06, 2012
  • Like
  • 0

 

 

I have an object Flag_Reporter__c which is child object in master detail relationship with Account...in an account trigger I have set the following code..in test class I having error: System.LimitException: Too many SOQL queries: 101

 

trigger Trg_After_Flag_Updater on Account (after update) {
    
    
    Boolean updateFlag = false;
    Boolean insertFlag = false;
    
    List<Flag_Reporter__c> lstFlagReporter = new List<Flag_Reporter__c>();
    
        Set<ID> aID = trigger.newMap.keySet();
        
        
        
        Map<ID,Flag_Reporter__c> fRC= New Map<ID,Flag_Reporter__c>();
        
        List<Flag_Reporter__c> flags = [Select Overall_Status__c,Overall_Status_Ranking__c,Account_Flag__r.Id,Flag_for_Editorial__c from Flag_Reporter__c Where Account_Flag__c IN : aID];
        for(Flag_Reporter__c fr: flags){        
            fRC.put(fr.Account_Flag__r.Id,fr);
        }
    for(Account accFlag:Trigger.new){
        
        Flag_Reporter__c fr;
        String editorial;
        if(fRC.get(accFlag.Id)!=NULL)
            fr = fRC.get(accFlag.Id);
        
        if(fr!=NULL){
            updateFlag = true;
            
            if(fr.Overall_Status__c == 'RED')
                fr.Overall_Status_Ranking__c = 1;
            else if(fr.Overall_Status__c == 'YELLOW')
                fr.Overall_Status_Ranking__c = 6;
            else if(fr.Overall_Status__c == 'GREEN')
                fr.Overall_Status_Ranking__c = 8;
                
             if(accFlag.Partner_Reviews__c!=NULL){
                if(accFlag.Partner_Reviews__c == '1')
                   fr.Flag_for_Editorial__c= 'RED';
                else 
                    fr.Flag_for_Editorial__c= 'GREEN';
             }
             lstFlagReporter.add(fr);
        }if(fr == NULL){
            insertFlag=true;
            lstFlagReporter.add(new Flag_Reporter__c(Account_Flag__c=accFlag.Id));   
        }
           
        
    
    }try{
        if(updateFlag==true)
            update lstFlagReporter;  
            
         if(insertFlag==true)
            insert lstFlagReporter;    
            
    }catch(Exception ex){
        ex.getMessage();
    }


}

 


stack is showing error in this place:

 

List<Flag_Reporter__c> flags = [Select Overall_Status__c,Overall_Status_Ranking__c,Account_Flag__r.Id,Flag_for_Editorial__c from Flag_Reporter__c Where Account_Flag__c IN : aID];

 

  • March 31, 2012
  • Like
  • 0

I am very new to Apex Coding. I want to write an Apex trigger on the Contact record to automatically populate the Contact Phone field with the related Account field phone number IF the "Contact & Account Phone the Same?" checkbox is checked. Following is the scenario:

 

1. If the Contact field "Contact & Account Phone the Same?" is TRUE (check box is checked), THEN
2. Automatically update the Contact "Phone" field with the same value in the Account "Phone" field.
Trigger = Before Update

 

I have written the following code that does not work (error message when trigger is saved) is listed below the code. Any help would be greatly appreciated.

 

trigger ContactPhoneUpdate on Contact (before update) { for (Contact cons: Trigger.new)
{ if (cons.Phone__C !=null ) { List<Account> accs = new List<Account>();
accs = [SELECT Id FROM Account WHERE AccountId = :cons.ID];
for(Account a: accs) { If(cons.Contact_Account_Phone_the_Same__c ==true)
{Cons.phone__c=accs.phone__c;
}
}
}
}}

 

Error message is as follows:

 

Error: Compile Error: No such column 'AccountId' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 3 column 8

 

Line 3 column 8 is this part of the code

 

[SELECT Id FROM Account WHERE AccountId = :cons.ID];

 

Thanks.

  • March 30, 2012
  • Like
  • 0

Hi,

I have uploaded a image file using document and now i want to use that image in VF page. How to reference an image uploaded in document in VF Page?

Hello,   I have to change a class that was created 2 years ago by a different colleague. The current test code coverage is 88% for the class and there is no clear test class available that I can see which has produced this test coverage result.  Is there a way to detrmine how this test coverage was provided? I.E. which classes resulted in the test code coverage being provided to the class I wish to change?

The idea is to Automatically follow all other chatter users when a new user is added.

 

The problem I am having is the trigger works when adding a new user as long as a Role is not specified upon creation.

When a Role is selected during creation the following error occurs.

caused by: System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): EntitySubscription, original object: User: []

 

Below is the trigger I have written:

trigger FollowAllChatterUsers on User (after insert) {
    //Create List to hold all chatterIds. they will need to be added.
    List<User> chatterIdsToAdd = new List<User>([SELECT Id from User WHERE IsActive = true]);
    Id currentUserId;
    
    //Take a count of how many users were added to fire this trigger.
    //If more than 10 then do not automatically follow.
    //The assumption is that if we batch-add more than 10 records we are probably
    //  loading saved data or backup data in which case the entitysubscriptions table
    //  will need to be loaded as well.
    Integer triggerLength = 0;
    for( User usr: Trigger.new ) {
        triggerLength++;
    }
    
    if (triggerLength <= 10) {
        // for each inserted user add all chatter ids except their own.
        for( User usr: Trigger.new ) {
            //Array of subscription records to create
            EntitySubscription[] subsToCreate = new EntitySubscription[]{};
            //Get the id of the current user.
            currentUserId = usr.Id;
            //Loop through list of users to add.
            for( User toAdd: chatterIdsToAdd ) {
                //If the id to add is our own then skip. otherwise cont..
                if ( toAdd.Id != currentUserId ) {
                    //Create the EntitySubscription record.
                    EntitySubscription follow = new EntitySubscription(
                        parentId = toAdd.Id,
                        subscriberId = currentUserId);
                    //Add new EntitySubscription to Array for insertion. 
                    subsToCreate.add(follow);
                }
            }
            //Insert the array.
            insert subsToCreate;
        }
    }
}

 

I read somewhere that within the same transaction a User record and a Role record cannot be update using DML.

I'm not sure if that the same issue I'm running into or not.

 

If anyone has any insight I would welcome your suggestions.

 

Thank You,

    Ramon

Hello all! 

 

I need to learn how to write a test code coverage for my account trigger, and i've tried many time, but I just can't get my head around the logic. I've read up on so many articles, but I couldn't find any which would apply to my particular scenario. 

 

Here's the trigger:

 

 

 

trigger OnAccountOwnerChanged on Account (before insert, before update) {
    for( Account a : Trigger.new )
    {
        Account AcctBeforeUpdate = Trigger.oldMap.get( a.Id );
        if( AcctBeforeUpdate.OwnerId != a.OwnerId )
        {
            a.Previous_Owner__c = AcctBeforeUpdate.OwnerId;
        }
    }
}

 

Can anyone help me with this? 

 

 

Ed.

 

Hi All,

 

I have the following requirement.

 

I want a TASK trigger (AFTER UPDATE) to execute a code that will write the Activity Type to a Google Spreadsheet in my Google Enterprise Account. 

 

Since this trigger will fire off any time a user records an Activity, I want the code to authenticate using a general Google account to write to this spreadsheet.

 

How can this be accomplished? The tutorials online are not helpful. As they do not cover Google Spreadsheets API inside Triggers. 

  • April 30, 2011
  • Like
  • 0

Hi

 

Is there any way to SELECT "All" the files of an object when using SOQL?

 

I know I'll need all the field of an object in my code and I'm trying avoid changing my SELECT query each time I add fields to the object.

 

How can I achive this?

 

Thanks

 

  • April 29, 2011
  • Like
  • 0
Hi,

I was just checking the order of execution of VF - http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_lifecycle_example.htm 

As per the above link the execution steps are as above (high level) :

controller constructor -> extension constructor -> component controller -> component extension controller if present.

But when I removed the extension from my page the execution is as follows:

component controller -> controller constructor -> extension constructor.

Not sure; but I thought that execution should not have changed. Anybody knows why it behaves this way?

Hi,

 

We are planning to develop an app in salesforce. The requirement is that; user should be able to access the app from browser, iPad and iPhone. Is it possible to develop one UI and access it from browser, iPhone and iPad. Or we have to design different UI's for iPhone, browser and iPad.

 

If anybody came across same situation feel free to put forward your suggestions/approach.

Hi,

 

I was writing a test class and in my test class I was querying Standard Pricebook

 

//Query Standard Price Book
 Pricebook2 pricebookObj = [select id from Pricebook2 where IsStandard = true];

 

This query works fine with API V-23. When we change the API version to 24 it gives System.QueryException - List has no rows for assignment to SObject.

 

Just gone through "Whats New" article for API version 24. But not found anything. Does anybody know what exactly the issue is?

Hi,

 

I have a VF page; which I am rendering as a PDF. In the page; I have a table which displays "QuoteLineItems".

I want that the table header should be repeated if the contents of "Table" goes over a page.

 

After doing research I found out that there is a css property which can be used to achieve this. But when I try to implement the solution it is not working. I have used following code(just a part of HTML)

 

Css that I have used -

<style>

thead { display: table-header-group;}

</style>

 

VF Page Code - 

<table border="0" width="100%" id="table4">
        <thead>
            <tr>
               <th bgcolor="#C0C0C0"><font face="Arial">{!$Label.quotePosition}</font></th>
               <th bgcolor="#C0C0C0"><font face="Arial">{!$Label.quoteDescription}</font></th>
               <!--<td bgcolor="#C0C0C0"><font face="Arial">Image</font></td>-->
               <th bgcolor="#C0C0C0"><font face="Arial">{!$Label.quoteQuantity}</font></th>
               <th bgcolor="#C0C0C0"><font face="Arial">{!$Label.quoteTotalPerPosition}</font></th>
            </tr>
        </thead>
        <tr>
            <apex:repeat value="{!lstQuoteLineItems}" var="quoteLineItemObj"> 
                <tr>
                     <td style="vertical-align:top">{!quoteLineItemObj.Position__c}</td>
                     <td style="vertical-align:top">{!quoteLineItemObj.Description}<br/>
                         <apex:outputField value="{!quoteLineItemObj.Product_Detail__c}"/> 
                     </td>            
                     <td style="vertical-align:top"><apex:outputText value="               {!quoteLineItemObj.Quantity}" /></td>
                     <td style="vertical-align:top"><apex:OutputField value=" {!quoteLineItemObj.Total_Per_Position__c}"/></td>
                 </tr>
                 <tr><td><br/></td></tr>
           </apex:repeat>
       </tr></table>

 

Does anybody implemented this sought of functionality; if yes, could you please share your thought or tell me what I am doing wrong here!!

 

Thanks in advance!!

 

Hi All,

 

We have to generate report using 4 objects.

 

Following are these objects.

1. Order

2. Product Line Item

2. Account

3. Specialization

 

The relationship is as follows:

--> means lookup.

 

Order --> Account

Product Line Item --> Order  and Product (Product Line child of Order (Master-Detail Relationship))

Specialization --> Account

 

We have to display the  Product Usage by Partner Type (field on Account) and Specialization.

If I select "Account" as my Primary Object for Report Creation; I am unable to get Order and Product Fields.

If I select "Specialization" as my Primary Object for Report Creation; I am unable to get "Order" and "Product Line" information on custom report type.

 

Does anybody have any workaround for this.

 

Any help is much appreciated!!

 

Hi ,

 

We have a code where we are querying the Account and Contact information of partner user.

 

When I use the "Login As Partner" button on contact to login to partner portal, I am able to get Account and Contact Information. And code works perfectly.

 

Now when I am writing the Test Class, I am inserting Account and Contact records.

Then I am using the method system.runAs(partnerUser) method.

The code looks as follows

 

insert accountObj;

 

Contact contactObj = new Contact();

contactObj.AccountId = accountObj.Id;

insert contactObj;

 

partnerUser.ContactId = contactObj.Id;

system.runAs(partnerUser)

{

    //Some code here.

    MyClassName.getPartnerInfo();

}

 

public with sharing class MyClassName

{

    public static PartnerInformation getPartnerInfo()

    {

           Contact contactObj = getContactInfo(UserInfo.getUserId());

           Account accountObj = getAccountInfo(contactObj.Id);

           //Code to create Partner Information record....

    }

}

 

the code fetches the Account Information when i mark my class as "without sharing". If i keep it as "with sharing" it does not fetch the Account Information. Not sure how the same code works when i click on "login as partner". 

 

 

Does anybody have any idea, or someone faced same issue??

 

Thanks,

Mandar.

 

Account account = getAccountInformation();

Hi,
Does anyobody have an idea regarding localization of Validation Error Messages. There are few validation rules set up and we have to localize those error messages. Does anybody already worked on same thing?



Hi,

 

We are localizing our partner portal. For Visualforce pages, we are using custom labels and workbench for localization.

 

So the visualforce page is showing up in localized format. But the issue is coming when we redirect the user to "standard" view page. The sandard view page is not getting localized.

 

For standard page to get localized, whether we have to do anything in addition, or salesforce by default converts it into localized format. Is any setting that needs to be activated for tht?

 

Your help will be much appreciated!!

 

Thanks In advance,

Mandar.

While accessing the Partner Portal I got following error.

 

1. You do not have the PRM Appexchange installed app in the set of custom apps on your profile.

2. UNKNOWN_EXCEPTION: PRM PORTAL SESSION NOT INITIALIZED.

 

Anybody knows why this error comes up??

 

Thanks,

Mandar.

Hi,

 

I have custom object called "Order" and "Oder Line Items". I wanted to have a "Clone" button on my page layout.

The button should work similar to standard clone button on Opportunity ie. while cloning my "Order"; i want it to ask me for Record Type and an option to clone with the "Order Line Items".

 

Is it possible using standard clone button. Also, anything needs to be done apart from adding "Clone" button page layout?

Hi All,

 

Does anybody know how to create a "Partner Portal User" dynamically.

We have a scenario where we have to create the Partner Portal Users dynamically. Account and Contact will be there and we have to create the user dynamically. For the salesforce org SSO is enabled. The SSO uses federated authentication.

 

Is there any API usign which we can create the Partner Portal Users dynamically?

 

Hi,

 

I have a profile which i have cloned from System Admin profile.

Now for this profile I would like to have "Author Apex" permission, so that user can create the Apex Classes and Triggers.

 

I also have one custom object. Now I dont want this object to be accessible for this profile.

So I removed all the permissions of this object. But as soon as I remove the permissions, the "Author Apex" checkbox gets unchecked. 

 

I am doing all these experiments in order to understand security features. Does anybody knows why salesforce behaves this way and the reason behind it?

 

Thanks in advance!!

Hello All,

 

I was trying to run the sample code for xmlStreamReader class from

http://www.salesforce.com/us/developer/docs/apexcode/index.htm

 

But when i try to save a class its giving me an error 

Method does not exist or incorrect signature: [XmlStreamReader].getLocalName()

 

Looks like a problem with sample code of XmlStreamReader class. Does anybody faced same problem?

Or I am doing some stupid thing :smileyindifferent:

Hi, I was looking into customer portals. I have checked into my developer instance for customer portal licenses. I found that for developer instance there are three license types

1) Customer Portal Manager

2) Platform Portal

3) High Volume Customer Portal

For each total 10 licenses are available.

 

Where is "Customer Portal Manager Standard" and "Customer Portal Manager Custom" license types, does they come with developer instance? or is it that

Customer Portal Manager = Customer Portal Manager Custom

Platform Portal = Customer Portal Manager Standard

 

Please help me to understand.

Hi,

 

I was reading the "Client Application Design" section of Web Service API v 20 Chapter 15 of "Web Service API Developers Guide". I noticed one thing that for API v 17 Salesforce has mentioned that "Exercise caution with multi-threaded processes" in which it is described that why you should be cautious while designing your client application with multi-threaded process.

 

While in Web Service API v 20 they have mentioned "Do not design a multi-threaded client application" - Multi-threading is not allowed for single client application using the SOAP-based API.

 

Can anybody please explain what "Multi-threading is not allowed for single client application using the SOAP-based API"

means? I just wanted to know what has changed in Version 20 so multi-threading is not allowed? and How?

Hi All,

 

I have heard the term "Single Apex Transaction" several times.

eg. A Single Apex Transaction can make max of 10 callouts.. etc.

 

Can anybody define what exactly this "Single Apex Transaction" means  or to be precise the scope of "Single Apex Transaction"?

 

Thanks,

Mandar.

Hi,

 

Anybody knows what is the best practice to do the separation of access to code and production data from security standpoint?

 

Thanks in advance!!!

 

When we provide the grant login access to salesforce.com Customer Support, are we not sacrificing the confidentiality and security of our data, as Salesforce can view the data or code present for the organization?

 

Also, are there any best practices or guidelines that one should follow when granting such access?

 

Thanks,

Mandar.

Hi all,

 

I am trying to configure the Facebook for Force.com.

 

For reference i am using this: http://wiki.developerforce.com/index.php/Installing_Force_for_Facebook#Installing_Subclipse

 

but when i checked in the repository: http://force4facebook.googlecode.com/svn/branches/force4facebook3_toolkit/src/pages/

 

I am unable to find the following pages:

MyFacebookSiteLogin, MyFacebookSiteTemplate, MyFacebookUnauthorized, MyHomePage, MyOtherProtectedPage, MyProtectedPage, MyFacebookCss.

 

As i have to give permissions for these pages on "Facebook Portal User" profile.

 

Any help is much appreciated!!!

 

Thanks,

Mandar.

Hi,

 

I need to get the ContactId from the User object. 

 

I have written the following code for it.

 

 

List<User> lstUser = [Select u.Id,u.ContactId from User u where u.Id = :idUser];
            if( lstUser != null && lstUser.size() > 0 )
            {
                System.debug('lstUser[0].ContactId::' + lstUser[0].ContactId);
                return lstUser[0];
            }

 

List<User> lstUser = [Select u.Id,u.ContactId from User u where u.Id = :idUser];            

if( lstUser != null && lstUser.size() > 0 )            

{

      System.debug('lstUser[0].ContactId::' + lstUser[0].ContactId);

      return lstUser[0];

}

 

but the System.debug statement prints as null.

 

If i try to execute the same query in the Force.com IDE, i got the correct result.

 

Also my class is running in System mode. 

 

Can anybody please tell me what i am doing wrong here.?

 

Hi,

I was just checking the order of execution of VF - http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_lifecycle_example.htm 

As per the above link the execution steps are as above (high level) :

controller constructor -> extension constructor -> component controller -> component extension controller if present.

But when I removed the extension from my page the execution is as follows:

component controller -> controller constructor -> extension constructor.

Not sure; but I thought that execution should not have changed. Anybody knows why it behaves this way?
I have an active process that populates a date field on a lead based on a specific task type being completed, otherwise the field is blank. This date field is a read only field to the users. My goal is to have a validation rule to check that if this date field (last_call_date_c) is NOT blank (in other words, has any date); then a comments field (last_call_comments_c) is then mandatory. Most of what i'm seeing in my search for possible solutions involves picklists which this is not so i'm struggling to locate a similar sytax.

Thanks in advance.
I have a process that invokes an @InvocableMethod Class, which should post to an endpoint. I am not getting any errors, but it isn't making the call. My Class is below. What am I missing? Any help is appreciated. Thank you!


global class SalesCloudOnboardCustomerClass {
  
    @InvocableMethod(label ='Call Sales Cloud' description='Sends the Opportunity Id to Sales Cloud.')
    public static void makeCallout(List<Id> ids) {
      System.debug('DebugMe ids: ' + ids);
      String endpoint='';
      HttpRequest request = new HttpRequest();
      // Set the HTTP verb to POST.
      request.setMethod('POST');

      for(Id id : ids){
        //Set the endpoint URL.
        Remote_Endpoint__mdt onboardCustomer = [select Endpoint__c from Remote_Endpoint__mdt where QualifiedApiName = 'OnboardCustomer' Limit 1];
          endpoint = onboardCustomer.endpoint__c + id;
        }
                
     
        // Set the endpoint URL.
        request.setEndPoint(endpoint);
        // Set timeout to 40 seconds.
        request.setTimeout(40000); 
        // Send the HTTP request and get the response.
        System.debug('DebugMe request: ' + request);
        //HttpResponse response = new HTTP().send(request);
        
      }

  }
I have a custom button calling a webservice but when slected I get this error:
{faultcode: 'soapenv:client', faultString: ' No Operation available for request {http://soap.sforce.com/schemas/package/CallTrexWebServiceInsideSales}TrexWebServiceInsideSales,please check the WSDL for the Service.' ,}
Not sure if its the button or the Class:
Button:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

{
 var retStr; 
 retStr = sforce.apex.execute("CallTrexWebServiceInsideSales", "TrexWebServiceInsideSales", {id:'{!Lead.Id}'}); 
}

Class
Global class CallTrexWebServiceInsideSales{
    
    public static Lead leads {get;set;}
    public static String myresponse{get;set;}

    public static string TrexWebServiceInsideSales (String id) {
    
        TrexWebServiceInsideSalesAsync(id);
        return myresponse;        
    }


    @future(Callout=true)
    webservice static void TrexWebServiceInsideSalesAsync(String id) {
    
        leads = [SELECT Email, FirstName , LastName , city  FROM Lead WHERE id =:id];
        
        if(String.isEmpty(leads.email)) {
            myresponse = 'This lead is either missing an email address or the Account Type field is NULL.' ; 
        }
        else
        {
            HttpRequest req = new HttpRequest();
            Http http = new Http();
            req.setMethod('GET');
            
            String ActivityType = 'Sales';
            string Subject = 'Trexpro and Dealer Locations sent to Consumer ';
                  
            String url = 'https://abc/def.asmx' + leads + ActivityType +Subject;
            req.setEndpoint(url);
            
            HTTPResponse resp = http.send(req);
            myresponse = resp.getBody();
         }
    }
}

It was not throwing an error earlier so I am assuming it is due to the Class changes made.  Any suggestions is appreciated.
M


 
Hi
i m a new admin and a maybe stupid question . 
2 teams in my company (sales and support ) 
I need to create 2  differents opportunity path . Sales must be able to view (not edit) the support's opportunity and vice versa . 

is it possible ? how ? 
I am attempting to complete the Hands-On Challenge in the 'Use Standard List Controllers' module and the exercise doesn't reflect what I just learned in the module.  For example the apex:repeat command isn't explained so I have no real idea about how to use it.  Can someone please provide an explanation?  Thanks.
Hello Everyone,

My test class is failing and I can't figure out why. Any assistance is greatly appreciated.

This is the error message:

System.QueryException: List has no rows for assignment to SObject

Method 1: System.QueryException: List has no rows for assignment to SObject 
Stack Trace: Class.portalRequestControllerTests.AAAAAAAAAAAAAAAtestInsert: line 126, column 1

Method 2: System.QueryException: List has no rows for assignment to SObject 
Stack Trace: Class.portalRequestControllerTests.testInsertContactNotMatched: line 155, column 1

Method 3: System.QueryException: List has no rows for assignment to SObject 
Stack Trace: Class.portalRequestControllerTests.testMisMatchedAccount: line 184, column 1

Method 4: System.AssertException: Assertion Failed: Same value: null 
Stack Trace: Class.portalRequestControllerTests.testVeterinarianSchool: line 24, column 1

Method 5: System.AssertException: Assertion Failed: Same value: null 
Stack Trace: Class.portalRequestControllerTests.test_method_one: line 46, column 1

This is the test class as a whole:

@isTest
private class portalRequestControllerTests {
  
  @isTest static void testVeterinarianSchool() {
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));
    RecordType rt             = [select Id from RecordType where SObjectType = 'Account' and Name  = 'Veterinarian School'];

      Account a    = new Account(Name='Test Account', RecordTypeId = rt.Id, Active__c = true, Account_Classification__c = 'School');
      insert a;


    List<Account> searchList       = portalRequestController.lookupAccount('Test Account');
    System.assertEquals(searchList.size(), 1);

      ctlr.pr.First_Name__c       = 'Joe';
      ctlr.pr.Last_Name__c       = 'Test';
      ctlr.pr.Email_Address__c     = 'test@mailinator.com';
      ctlr.clinicId           = portalRequestController.lookupAccount('Test Account')[0].Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = ctlr.getLanguageOptions()[0].getValue();

      ctlr.createRequest();
      System.assertNotEquals(ctlr.pr.Id, null);

  }


  @isTest static void test_method_one() {
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));

        Account a    = new Account(Name='Test Account', RecordTypeId = slimfitUtils.getClinicAccountRecordType().Id, Active__c = true, Account_Classification__c = 'School');
        insert a;

      ctlr.createRequest();

      ctlr.pr.First_Name__c       = 'Joe';
      ctlr.pr.Last_Name__c       = 'Test';
      ctlr.pr.Email_Address__c     = 'test@mailinator.com';
      ctlr.clinicId           = portalRequestController.lookupAccount('Test Account')[0].Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = ctlr.getLanguageOptions()[0].getValue();

      ctlr.createRequest();
      System.assertNotEquals(ctlr.pr.Id, null);
  }
  

  @isTest static void test_rejection() {
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));

      ctlr.createRequest();

      ctlr.pr.First_Name__c       = 'Joe';
      ctlr.pr.Last_Name__c       = 'Test';
      ctlr.pr.Email_Address__c     = 'test@mailinator.com';
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';

      ctlr.createRequest();
      System.assertEquals(ctlr.pr.Id, null);
  }



  @isTest static void testExistingPortalRequest() {
      Account a    = new Account(Name='Test Account');
      insert a;

        Portal_Request__c portalReqObj1           = new Portal_Request__c ();
        portalReqObj1.First_Name__c   = 'TestFirstName1';
        portalReqObj1.Last_Name__c     = 'TestLastName';
        portalReqObj1.Status__c        = 'New';
        portalReqObj1.Clinic__c       = a.id;
        portalReqObj1.Email_Address__c   = 'TestMail@testing.com';
        insert portalReqObj1;

    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));

      ctlr.pr.First_Name__c       = 'Joe';
      ctlr.pr.Last_Name__c       = 'Test';
      ctlr.pr.Email_Address__c     = portalReqObj1.Email_Address__c;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';

      ctlr.createRequest();
      System.assertEquals(ctlr.pr.Id, null);
  }



    static testMethod void AAAAAAAAAAAAAAAtestInsert() {
    // prod
    ExactTarget_Settings__c settings = new ExactTarget_Settings__c(
      accessToken__c='bg5ccutef4qqcdxkjk63bd2u', 
      accessToken_Expiration_Date__c = Datetime.now().addYears(1),
      TriggeredSendEmail_Endpoint__c = 'https://www-exacttargetapis-com-nhz9abyp4su1.runscope.net/messaging/v1/messageDefinitionSends/key:%7B0%7D/send?access_token={1}',
      requestToken_EndPoint__c = 'https://auth.exacttargetapis.com/v1/requestToken',
      clientSecret__c = 'k6fs4dkvJr6XC3Uzw4yxVrYT',
      clientId__c = 'xdf5ehwugdv5afpybxrda9uq'
    );
    // dev
    //TMSSettings__c settings = new TMSSettings__c(Blocked_Off_Record_Type_ID__c=blackoutRecordTypeId, Shipment_Record_Type_ID__c=shipmentRecordTypeId, Carrier_New_Ship_Email_Template_ID__c='00XW0000000I8juMAC', Carrier_Profile_ID__c='00eW0000000QMpFIAW', Carrier_Updated_Ship_Email_Template_ID__c='00XW0000000I8jpMAC', From_Email_Notification_ID__c='0D250000000TN1PCAW', Portal_Domain_Name__c='  royalcanincanada.force.com', TMS_RC_Notification_Group_ID__c='00G50000001jledEAA', Warehouse_Address__c='Any street, Toronto', Warehouse_Phone__c='9056667890', Warehouse_Profile_ID__c='01IW0000000D4fx' , POD_Logistics_Email_Template_ID__c='00XW0000000I9xxMAC', POD_Carrier_Email_Template_ID__c='00XW0000000I9xsMAC');
    insert settings;

      Account a    = new Account(Name='Test Account');
      insert a;
        Account a1    = [select Id, OwnerId from Account where Id = :a.Id];

        Contact c    = new Contact(FirstName = 'first', LastName = 'last', Email = 'test@me.com', AccountId = a.Id, RecordTypeId = slimfitUtils.getClinicVetRecordType().Id, Vet_Portal_Welcome_Sent__c = true);
        insert c;
        
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));

      ctlr.pr.First_Name__c       = 'Arthur';
      ctlr.pr.Last_Name__c       = c.LastName;
      ctlr.pr.Email_Address__c     = c.Email;
      ctlr.ClinicId           = a.Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = 'en_US';
      ctlr.pr.Email_Opt_In__c     = true;
      ctlr.createRequest();

    Portal_Request__c pr         = [select Id, Status__c, Clinic__c from Portal_Request__c where Id = :ctlr.pr.Id];
      //System.assertEquals(pr.Status__c, 'Approved');
      System.assertEquals(pr.Clinic__c, a.Id);

    Contact cCheck     = [select Id, FirstName, Vet_Express_Consent__c from Contact where Id = :c.Id];
    System.assertEquals(cCheck.FirstName, ctlr.pr.First_Name__c);
    System.assertEquals(cCheck.Vet_Express_Consent__c, true);
    }


    static testMethod void testInsertContactNotMatched() {
      Account a    = new Account(Name='Test Account');
      insert a;
        Account a1    = [select Id, OwnerId from Account where Id = :a.Id];

        Contact c    = new Contact(FirstName = 'first', LastName = 'last', Email = 'test@me.com', AccountId = a.Id);
        insert c;
        
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));
      ctlr.pr.First_Name__c       = 'Arthur';
      ctlr.pr.Last_Name__c       = c.LastName;
      ctlr.pr.Email_Address__c     = c.Email;
      ctlr.ClinicId           = a.Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = 'en_US';
      ctlr.pr.Email_Opt_In__c     = true;
      ctlr.createRequest();

    Portal_Request__c pr         = [select Id, Status__c, Contact__c, Clinic__c from Portal_Request__c where Id = :ctlr.pr.Id];
      System.assertEquals(pr.Contact__c, null);
      System.assertEquals(pr.Clinic__c, a.Id);

    Contact cCheck     = [select Id, FirstName, Vet_Express_Consent__c from Contact where Id = :c.Id];
    System.assertNotEquals(cCheck.FirstName, ctlr.pr.First_Name__c);
    System.assertNotEquals(cCheck.Vet_Express_Consent__c, true);
    }


    static testMethod void testMisMatchedAccount() {
      Account a    = new Account(Name='Test Account');
      Account b     = new Account(Name='B Account');
      insert new List<Account> { a, b };

        Contact c    = new Contact(FirstName = 'first', LastName = 'last', Email = 'test@me.com', AccountId = b.Id);
        insert c;
        
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));
      ctlr.pr.First_Name__c       = 'Arthur';
      ctlr.pr.Last_Name__c       = c.LastName;
      ctlr.pr.Email_Address__c     = c.Email;
      ctlr.ClinicId           = a.Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = 'en_US';
      ctlr.pr.Email_Opt_In__c     = true;
      ctlr.createRequest();

    Portal_Request__c pr         = [select Id, Status__c, Clinic__c from Portal_Request__c where Id = :ctlr.pr.Id];
      //System.assertEquals(pr.Status__c, 'Approved');
      System.assertEquals(pr.Clinic__c, a.Id);
      System.assertNotEquals(pr.Status__c, 'Approved');

    List<User> uList           = [select Id from User where Email = :c.Email];
    System.assertEquals(uList.size(), 0);

    List<Account> searchList       = portalRequestController.lookupAccount('Account');
    System.assertEquals(searchList.size(), 0);
    }}

I have highlighted error 
I can't get the Pagination piece of the course to work in my preview.  See the code I'm using per the instructions:

<apex:page standardController="Contact" recordSetVar="contacts">
  <apex:form>
    <apex:pageBlock title="Contacts List" id="contacts_list">
        
        Filter:
        <apex:selectList value="{! filterId }" size="1">
            <apex:selectOptions value="{! listViewOptions }"/>
            <apex:actionSupport event="onchange" reRender="contacts_list"/>   
        </apex:selectList>
        
        <!-- Contacts List -->
        <apex:pageblockTable value="{! contacts }" var="ct">
            <apex:column value="{! ct.FirstName }"/>
            <apex:column value="{! ct.LastName }"/>
            <apex:column value="{! ct.Email }"/>
            <apex:column value="{! ct.Account.Name }"/>
            
            <!-- Pagination -->
<table style="width: 100%"><tr>
    <td>
        Page: <apex:outputText 
    value=" {!PageNumber} of {! CEILING(ResultSize / PageSize) }"/>
    </td>            
    <td align="center">
<!-- Previous page -->
<!-- active -->
<apex:commandLink action="{! Previous }" value="« Previous"
     rendered="{! HasPrevious }"/>
<!-- inactive (no earlier pages) -->
<apex:outputText style="color: #ccc;" value="« Previous"
     rendered="{! NOT(HasPrevious) }"/>
&nbsp;&nbsp;  
<!-- Next page -->
<!-- active -->
<apex:commandLink action="{! Next }" value="Next »"
     rendered="{! HasNext }"/>
<!-- inactive (no more pages) -->
<apex:outputText style="color: #ccc;" value="Next »"
     rendered="{! NOT(HasNext) }"/>
    </td>
    
    <td align="right">
        Records per page:
<apex:selectList value="{! PageSize }" size="1">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="20"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>
    </td>
</tr></table>

            
            
            
        </apex:pageblockTable>
    </apex:pageBlock>
  </apex:form>
</apex:page>
Hello,
I have an embedded VF Page in my Leads which pulls a custom onbject Documents, and displays all Documents in the list as below:
User-added image
You can probably tell what I'd like to do is upload a file to 'Proposal' and another one to other doc types I do not have listed there, and then click the 'Save All Docs Attached' button and have the attachments save properly to eash Document Type which is a separate record. Right now when I click Save it saves the attachment to each of the Doc Types in the list. Is there a way I can save the Attachment to a List, then have the List save to each respective Doc Type?
Apex:
public with sharing class LeadDoc{
    public ApexPages.StandardController Controller;
    public LeadDoc(ApexPages.StandardController Controller){
        this.Controller = Controller;}
    public Id getid {get;set;}{
        getid = ApexPages.currentPage().getParameters().get('id');}
    public List<Lead> Lds {get;set;}
    public List<Document__c> Docs {get;set;}
    public String fileName {get;set;}
    public transient Blob fileBody {get;set;}
    
    public LeadDoc(){
        Lds = [SELECT Id, Name FROM Lead WHERE Id =: getid];
        Docs = [SELECT Id, Name,Count_Attachments__c,Attach_Request_Status__c, Document__c,View_Doc__c,
                Lead__c FROM Document__c WHERE Lead__c =: Lds[0].Id];
    }
    public PageReference Save(){
        //List<Attachment> att = fileBody;
        for(Document__c doc : Docs){
            if(fileBody!=null){
                Attachment attachment = new Attachment();
                attachment.body = fileBody;
                attachment.name = this.fileName;
                attachment.parentId = doc.Id;
                insert attachment;}
        }
        return null;
    }
}

 
I'm trying to add a jQuery data table in Salesforce lightning component. Here is the code. It is not loading at all. What am I doing wrong?
<ltng:require scripts="{!join(',','//cdn.datatables.net/1.10.4/css/jquery.dataTables.css'
                        ,'//code.jquery.com/jquery-1.12.4.js'
                        ,'//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js'
                        ,'//cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js'
                        ,'//cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js'
                        ,'//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js'
                        ,'//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js'
                        ,'//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js'
                        ,'//cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js'
                        ,'//cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js')}"
            afterScriptsLoaded="{!c.afterscriptsLoaded}"/>

or

<ltng:require scripts="{!join(',',$Resource.datatable + '/DataTables-1.10.16/css/jquery.dataTables.css'
                           ,$Resource.datatable + '/jQuery-1.12.3/jquery-1.12.3.js'
                            ,$Resource.datatable + '/DataTables-1.10.16/js/jquery.dataTables.min.js'
                           ,$Resource.datatable + '/Buttons-1.5.1/js/dataTables.bootstrap.min.js'
                            ,$Resource.datatable + '/Buttons-1.5.1/js/buttons.flash.min.js'
                            ,$Resource.datatable + '/JSZip-2.5.0/jszip.min.js'
                            ,$Resource.datatable + '/pdfmake-0.1.32/pdfmake.min.js'
                            ,$Resource.datatable + '/pdfmake-0.1.32/vfs_fonts.js'
                            ,$Resource.datatable + '/Buttons-1.5.1/js/buttons.html5.min.js'
                            ,$Resource.datatable + '/Buttons-1.5.1/js/buttons.print.min.js')}"
              	afterScriptsLoaded="{!c.afterscriptsLoaded}"/>



<table id="showContacts" class="slds-table slds-table--bordered slds-table--cell-buffer">
          <thead>
            <tr class="slds-text-title--caps">

                <th class="slds-is-sortable slds-text-title--caps">

                  <span class="slds-truncate" title="EID">EID</span>  

               </th>

               <th class="slds-is-sortable slds-text-title--caps">

                  <span class="slds-truncate" title="Name">Name</span>

               </th>
          </tr>
  </thead>
  <tbody>
      <tr>
         <td scope="row">
             <div class="text-wrap">10887738</div>
         </td>
         <td>
            <div class="slds-truncate  text-wrap" title="Adam Will"><a href="javascript:void(0);">Adam, Will</a></div>
         </td>
    </tr>
</tbody>
</table>


({
afterscriptsLoaded : function(component,event,helper){
    j$('[id$="showContacts"]').DataTable({
            "scrollY": "260px",
            "scrollCollapse": true,
            "paging": true,
            "searching": true,
            "ordering": true,
            "info": true,
            "dom": 'Bfrtip',
           "destroy" : true,
            "buttons": [
                        'copy',
                        {extend: 'csv',title: 'Criteria export'},
                        {extend: 'excel',title: 'Criteria export'},
                        {extend: 'pdf',title: 'Criteria export'},
                        'print'
            ]
        } );
},


})

My question is about how to show this table on lightning component in Salesforce? Whenever I load the page I see a blank page.
Note: I am showing a sample table. this is not the total table
After spending close to two hours on the phone with Salesforce support, they suggested I should post here to find a solution to my problem. So now I am at the mercy of you kind developers prowling these boards and I am hopeful that together we can find a solution to my problem.

The Problem
Case ownership is transferring between users and my default support queue without the user's input, however, it appears as if the user is the one transferring the case. This can occur minutes after they initially take ownership, and sometimes it happens several hours later. It occurs with both open and closed cases, the latter be especially frustrating since the newly assigned owner will go to work the case without realizing it's already been closed. I have also verified that this is happening both during and after hours - when users are no longer logged into the system  - so I know that they are not the ones transferring the cases despite the Case feed suggesting otherwise. 

Investigation Thus Far
Assignment Rules - Even though I assumed this had nothing to do with assignment rules, I double checked. Sure enough, there are no active assignment rules - nor are there any Case page layouts where the 'Assign using active assignment rules' is visible and/or checked by default.

Apex Triggers - Salesforce support suggested this was the cause, which makes sense, but I looked and there are no active Apex Triggers that I have written / implemented, which would cause this behavior. In fact, there are only three (3) Case object triggers, all of which are managed by installed packages, and none of which are desigend to do anything with regards to Case ownership (one is related to our mapping software and the other two are for a contest/gamification application)

 
I just want to thank everyone in advance for any support or guidance you can provide here. Please let me know if there is anything else I should provide that would help diagnose the issue here.

Thank you.

Ben
 
  • November 23, 2016
  • Like
  • 0
Im very new to SF Dev, and I've written my first trigger Befire Insert for newly created Opp Products.   At the opp level, there is a custom field "Corp Ad Class"  Picklist.  When the Opp is created, this field must be assigned a pickist value. 

The trigger is for each new Opp product created on that opp, I want it to enter the Corp Ad Class from the Opportunity as the default value.   I was unsuccessful accessing the Opportunity field to assign the data.  I had to create a custom formula field to capture the Picklist value first and then I could do the assignment using that field.  I'd like not to have these extra fields if I can aviod them and I assume I can access the parent related record to collect the data as need.

This is what I've come up with :

//Replicates the Opportunity level Corp Ad Class to each product line
trigger StampCorpAdClassNewRec on OpportunityLineItem (Before Insert)
{
for(OpportunityLineItem OpportunityLineItem:Trigger.new)
    {
    OpportunityLineItem.Corp_Ad_Class__c = OpportunityLineItem.OppCorpAdClass__c ;  
    }
}

Opportunity.Corp_Ad_Class__c is what I first placed to the right of the = but it errored.  I was attempting to reference the Master Record field value, Corp Ad Class field on the Opportunity Object.

OpportunityLineItem.OppCorpAdClass__c is a formula field "text(Opportunity.Corp_Ad_Class__c)"; referencing this field, the trigger works, I can make the default value assignment using that field.  Its likely the most efficient way to do this.  I've created an extra field I likely do not need.

Reading other posts on the topic, It appears I may possibly do a SOQL query for the field value then assign it to oppproduct field.   Im not quite sure.    Any feedback for a better would be greatly appreciated.

thank you, David

 
Hi All,
I have an attachment with "Anyone with link" sharing configuration. How can I retrieve (or construct) the actual sharing URL using the apex code?
E.g., I have an attachment with id: 069240000009bdU and ViewAll permissionsI. From UI (web) I can see that its URL is:
https://ap1.salesforce.com/sfc/p/90000000t55g/a/90000000Chhk/fZcNyce65hRkHRM95T0nhPrJUNHiJ47If6BLyK24ixY
How can I get this URL through Apexcode and update to custom field?

Thanks in Advance.
I need to create multiple list views for several users, how can I do this quickly in APEX?
I do not have the option in IE 11 to switch to Lightning Experience.  I do, however, have the option in Chrome.  What might be the issue?

What I see in Chrome:
Chrome

What I see in IE 11:
IE 11
IE 11 version information:
User-added image
I'm looking to find the object types of the WhatId/WhoId fields of the Task and Event objects, so I can query these objects and get more information about them and perform certain automated tasks based on the type.

I found this tech article, which uses the first 3 digits as a marker, but the article also says that this may change at any time:

http://www.sforce.com/us/resources/tn-1.jsp

Is there a better way of getting the object types of WhatId/WhoId fields or querying them based on Id only (no type)?

Thanks!
I am calling a server side action from a Lightning Component. When an error occurs I am trying to log them in a custom object using an @future method and then throwing an AuraHandledException so the component can display the message. It seems like this won't work with AuraHandledException since it causes a Script-thrown execption in the logs which causes the @future method not to execute. Am I doing something wrong or is there another way to accomplish it?

Here is documentation I am referencing:

Error Handling Best Practices for Lightning and Apex:
https://developer.salesforce.com/blogs/2017/09/error-handling-best-practices-lightning-apex.html

An Introduction to Exception Handling:
https://developer.salesforce.com/page/An_Introduction_to_Exception_Handling
 
@auraEnabled
public static void getSomething(){
    
    try{
        //Do Something here 
        
    }catch(exception e){
        
        //@future - log error in custom object
        futureCreateErrorLog.createErrorRecord(e.getMessage());
        
        throw new AuraHandledException('Error message to display in component');
    }
    
}

User-added image