• sorna
  • NEWBIE
  • 415 Points
  • Member since 2009

  • Chatter
    Feed
  • 16
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 46
    Questions
  • 89
    Replies

Hello,

 

I am trying to create a simple query involving the account object, and a custom object. But the query causes an error of 

 

"INVALID_TYPE - Didn't understand relationship"

 

The affiliation object is a child relative to Account and both values are strings so I am not sure what the issue is. The query is below.

 

SELECT Name, (SELECT ContactLastName FROM npe5__Affiliation__c) FROM Account

 

 

  • August 28, 2012
  • Like
  • 0

Hi all,

 

I have custom object which is master detail on opportunity. The custom object configured with page layout that has a custom button which on-click goes to VF page. 

 

When I click on "new"  from the custom object related list on opportunity the page does not contain the custom button. However when I click on edit page the button appears. What could be issue

 

Please help.

 

Thanks

Shuba

Hi,

 

I observed some odd behaviour while deploying some components from Sandbox to Production.

 

When I logged in as "A" and tried to deploy a change set to my Production environment, I got 21 failures due to classes in the Production envt. Where as when I logged in as "B" and tried to deploy the same changeset I got only 2 errors.

The 2 errors were due to the dependency of a test class in Production(it was querying  an object in the envt, which no longer existed)

So I figured out the problem, corrected it and re-deployed using login "B". The 2 errors vanished and I could deploy successfully.

 

However when I login as "A", I can still see 14 errors (all related to Validation rules). Both "A" and "B" are assigned the same Profile. However Role assigned is different.

 

Can anybody tell me why is the behaviour like this ? Is there any setting that can change the behaviour ?

 

 

Regards,

Lakshmi. 

  • August 20, 2012
  • Like
  • 0

Hi,

 

I really need a hand on this, I have been struggling for around 5 hours and I didnt get anything...

 

I had created a custom conversion button on my visualforce page. This button will call a method declared on my leadextension controller. Yesterday it worked without any problem....today I created a few new fields and change the code a bit and didnt work. I made the conversion method as simple as possible because I thought that way I would find my problem. Still getting the same error message...

 

This is the visualforce page where the button is and calls the method:

 

<apex:page standardController="Lead" showHeader="true" extensions="LeadExtension">
    <apex:form >
        <apex:pageBlock title="Account Creation" id="Account_Creation" mode="Read">
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Create Account" action="{!CustomConversion}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:PageBlockButtons>
            <apex:pageBlockSection columns="2">
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Commercial Name"/>
                        <apex:outputLabel value="{!lead.Company}"/>
                    </apex:pageBlockSectionItem>
                    <!--MORE FIELD TO SHOW DECLARE IN HERE-->
              </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 And this id the code of my Class that contains the method:

 

public class LeadExtension {
    public class MyException extends Exception{}
    private Lead l1;
    private Lead l2;
    String result='Click on an account to fetch the data';
        
    public LeadExtension(ApexPages.StandardController stdController) {
       this.l1 = (Lead)stdController.getRecord();
       this.l2= [Select Name,Customer_Connectivity__c,Acquisition_Channel_Description__c, OwnerId, Fiscal_Number_2__c, Fiscal_Number_1__c, 			      Relationship__c,Commercial_Group__c,Commission_Group__c,Fiscal_Name__c,Street_fiscal__c,City_fiscal__c,Post_Code_fiscal__c,Country_Fiscal__c,Province_Fiscal__c,
       			FirstName,LastName,Salutation,Contact_Role__c,Contact_Job_Titel__c,Email,Phone,Contact_Language__c,
       			Currency_to_invoice__c,Billing_Language__c,WhiteLabel_Type__c,Web_Currency__c,RecordTypeId,Website,Number_of_Employees__c,
       			Bank_Name__c,Bank_Account_Number__c,Bank_Account_Holder__c,Bank_Account_Country__c,Routing_Number__c,   			
       			Email_Admin_Finance__c,Fax_Admin_Finance__c,Phone_Admin_Finance__c,First_Name_Admin_Finance__c,
       			Last_Name_Admin_Finance__c,Commercial_Contact_equals_Admin_Contact__c,Web_User_1_Last_Name__c,Web_User_2_Last_Name__c,
       			Web_User_3_Last_Name__c,Web_User_4_Last_Name__c,Web_User_1_Salutation__c,Web_User_2_Salutation__c,Web_User_3_Salutation__c,
       			Web_User_4_Salutation__c,Web_User_1_Name__c,Web_User_2_Name__c,Web_User_3_Name__c,Web_User_4_Name__c,Web_User_Email_1__c,
       			Web_User_Email_2__c,Web_User_Email_3__c,Web_User_Email_4__c From Lead Where (Id=:l1.Id)];
    }
     
    
    public pageReference CustomConversion()
    {
    	/*database.Leadconvert lc = new database.Leadconvert();
    	Database.Leadconvertresult lcr;
    	lc.setLeadId(l2.Id);
    	lc.setConvertedStatus('Converted');
    	lc.setDoNotCreateOpportunity(True);
    	Integer NumErrores=0;
    	String ErrorMessage;
    	
    	lcr=Database.convertLead(lc);
        pageReference pageRef= apexpages.currentPage();//new PageReference('/apex/CustomAccount?id='+lcr.getAccountId());
        return pageRef;*/
        
        Database.LeadConvert lc = new database.LeadConvert();
	lc.setLeadId(l1.id);

	lc.setConvertedStatus('Converted');

	Database.Leadconvertresult lcr=Database.convertLead(lc);
	pageReference pageRef=new PageReference('/apex/CustomAccount?id='+lcr.getAccountId());
	return ApexPages.currentPage();
    }

 And the error message I get is:

------------------------------------------------------------------------------------------------------

Visualforce Error
 


System.DmlException: ConvertLead failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: []

Error is in expression '{!CustomConversion}' in component <apex:page> in page conversionscreen

 

 

Class.LeadExtension.CustomConversion: line 52, column 1

-----------------------------------------------------------------------------------------------------------------

 

The line 52 is the one that says: 

 

Database.Leadconvertresult lcr=Database.convertLead(lc);

 

Really appreciate your help. Regards,

 

Antonio

Hi, I can' t get a simple SOQL query to work, which tries to get all the contacts from a certain account.

Here is my sample code:

 

trigger triggerDNC on Contact (before update) 
{
    //Assign the context before and after the change into a Map
    Map<Id,Contact> newContactMap = Trigger.newMap;
    Map<Id,Contact> oldContactMap = Trigger.oldMap;

    //Loop through the map
    for(Id contactId:newContactMap.keySet())
    {
         Contact myNewContact = newContactMap.get(contactId);
         Contact myOldContact = oldContactMap.get(contactId);
		 
		 // myNewContact.Account.Name DOESNT WORK HERE ?
		 
		 List<Contact> cons= 
              [SELECT Contact.Name, Contact.Phone, Contact.DoNotCall, Contact.Account.Name FROM Contact
                   WHERE Contact.Id!= :myNewContact.Id
                   AND Contact.Account.Id = :myNewContact.Account.Id]; // this doesnt filter out correctly
                         
               for (Contact con: cons) 
               {
                   // con.Account.Name WORKS HERE !!?
               }
                
               update cons;
	} 
}

 I can't access myNewContact.Account.Name or myNewContact.Account.Id, so I can't find a way to get only the contacts from the same account as the one in the trigger.

Any help / feedback would  be greatly appreciated .. thanks.

I am looking for a way to autopopulate a field in contacts based on the content from a field in accounts. Specifically, 2 fields - "Type" and "Industry".Both are single drop-down.

Please help in the following query

 

Child object child1 has a master detail relationship with both master1 and master2

 

The following query does not work for me

 

SELECT name FROM Child1 Where master1__r.cust1__c = master2__r.cust2__c

 

 

  • January 20, 2012
  • Like
  • 0

Hi Everyone!
While building a list of SelectOptions of Users, all options default to unselected.  However, when the User matches the logged-on user, we need to set the SelectOption to selected.  How can this be done in the following code?


public List<SelectOption> getFSEOptions() {

  List<SelectOption> FSEoptions = new List<SelectOption>();

  for (Field_Service_Engineer__c f : [select id, user__r.name from Field_Service_Engineer__c

                                                             order by user__r.name]) {

    FSEoptions.add(new SelectOption(f.id,f.user__r.name));

  }
  return FSEoptions;

}

hi i was just practicing SOQL queries and i wrote a test query in apex explorer

 

 

Select Id, Name, Industry,Company_Relationship__c From Account where Company_Relationship__c='Employee' and Lead_Created_Date__c=System.today()

 

 

and when i tried to execute i am getting an error can anyone tell me where my error is.

 

error: unexpected token 'system.today()'

This is what I have right now, but I want the select options list to show the field label to the user and pass the field name when selected by the user.

 

Schema.DescribeSObjectResult obj = Quote_Comment__c.sObjectType.getDescribe(); Map<String, Schema.SObjectField> objFields = obj.fields.getMap(); for( String fieldName : objFields.keySet() ) { orderByOptions.add(new SelectOption(fieldName,fieldName )); }

 

I have a VF page that includes two pageBlock sections that call update methods.  Is it possible to validate only the pageBlock section where the update method is getting executed?

 

Here is my VF code:

 

<apex:page Controller="AccountMaintenanceController"> <h1>Manage Salesperson Territory Assignments</h1> <apex:form > <apex:pageBlock title="Update Specific District or Account Ownership" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!updateChildAccountOwnership}" value="Update" rerender="UpdateChildAccountsSuccessMsg" /> <apex:commandButton action="{!cancel}" value="Cancel" immediate="true" /> </apex:pageBlockButtons> <apex:pageMessages rendered="true" id="UpdateChildAccountsSuccessMsg" /> <apex:pageBlockSection title="Used to update owner of specified account and related child accounts" columns="1"> <apex:pageBlockSectionItem > <apex:outputLabel value="Change Owner To" for="new_account_owner" /> <apex:inputField value="{!AccountToByParent.ownerId}" id="new_account_owner" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="District Account to update" for="account_name" /> <apex:inputField value="{!DistrictAccount.parentId}" id="account_name" required="true" /> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock title="Update Account Ownership by State" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!updateAccountByState}" value="Update" rerender="UpdateOwnerByStateSuccessMsg" /> <apex:commandButton action="{!cancel}" value="Cancel" immediate="true" /> </apex:pageBlockButtons> <apex:pageMessages rendered="true" id="UpdateOwnerByStateSuccessMsg" /> <apex:pageBlockSection title="Used to update owner of accounts by selected state" columns="1"> <apex:pageBlockSectionItem > <apex:outputLabel value="Change Owner To" for="new_account_owner" /> <apex:inputField value="{!AccountToByState.ownerId}" id="new_account_owner" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="State" for="state" /> <apex:inputField value="{!State.State__c}" id="state" required="true" /> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

controller class:

 

public class AccountMaintenanceController { private Account acctToByParent = new Account(); private Account parentAcct = new Account(); private Account acctToByState = new Account(); private Account state = new Account(); public PageReference updateChildAccountOwnership() { Account parent = [Select Id, OwnerId From Account where Id =: parentAcct.ParentId]; List<Account> childAccts = [Select Id, OwnerId From Account where ParentId =: parent.Id]; parent.ownerId = acctToByParent.ownerId; DbUtil.save(parent); List<Account> lst = new List<Account>(); for (Account acct: childAccts) { acct.OwnerId = acctToByParent.OwnerId; lst.add(acct); } DbUtil.save(lst); ApexPages.Message msg = new ApexPages.message(ApexPages.Severity.INFO, 'Account ownership updated successfully.'); ApexPages.addMessage(msg); return null; } public PageReference updateAccountByState() { List<Account> accts = [Select Id, OwnerId From Account where state__c =: state.state__c]; List<Account> lst = new List<Account>(); for (Account acct: accts) { acct.OwnerId = acctToByState.OwnerId; lst.add(acct); } DbUtil.save(lst); ApexPages.Message msg = new ApexPages.message(ApexPages.Severity.INFO, 'Account ownership updated successfully.'); ApexPages.addMessage(msg); return null; } public PageReference cancel() { PageReference newpage = new PageReference(System.currentPageReference().getURL()); newpage.setRedirect(true); return newpage; } public Account getAccountToByParent() { return acctToByParent; } public Account getDistrictAccount() { return parentAcct; } public Account getAccountToByState() { return acctToByState; } public Account getState() { return state; }

 

 

So, when I click the update button in either one of the pageBlock sections, it validates both pageBlock sections, so I cannot execute the update methods in the pageBlock sections independently.

 

Thanks for any help.


I want to send a e-mail with a link to an object...How would one get server URL in Apex?



I am trying to find out if the Delegated Authentication is supported for Salesforce Communities. I was browsing through the Salesforce documentation. But I don't find a definite answer. Could anyone let me know?

thanks in advance!
  • July 31, 2014
  • Like
  • 0

I am building a custom VF page to show the ideas. I want to get the list of categories that are assigned to an idea zone. For ex: I have created 3 zones: zone A, zone B, zone C for ideas. I have assinged Categories

Categories 1, 2, 3 to zone A,

Categories 4, 5, 6 to zone B,

Categories 3, 5, 6 to zone C.

 

If I go to standard Ideas tab, somehow salesforce could show the correct list of categories drop down for each zone. where as I don't find any option in Apex to query the list of assigned categoried for each zone.

 

Any suggestions please?

 

 

  • December 08, 2013
  • Like
  • 0

Hi, 

This may be a basic question.

Let's say I create a web services apex class. Where is the UDDI for this class?

  • February 17, 2013
  • Like
  • 0

Hi All,

I don't know anything about php. But I have a set of php files and I have to run them with in Salesforce. Is that do-able? Can I just reference a php file in a visualforce page like how I reference a HTML in IFrame? Any idea is appreciated.

 

Thanks,

Sorna

  • January 22, 2013
  • Like
  • 0

Hi,

I have to get a cross object field value from sobject. For ex: 

 

Contact c [Select Account.Name from Contact Limit 1];
Sobject s = (Sobject) c;
System.debug('Account Name: '+c.Account.Name);
System.debug('Account Name: '+s.get('Account.Name'));

 In the above code, the 1st debug will work where as for the 2nd debug, it is throwing an error that Account.Name is not a valid for Contact. Any idea on how to get the parent's field values from a SObject?

 

 

Thanks in advance,

Sorna

  • January 21, 2013
  • Like
  • 0

Hi Guys,

I need to control the status field of the Entitlement. As a standard functionality, if the system date (Today's date) is between start and end dates, the status is active and if it is greater than end date, status automatically changes to expired. But I need to customize this logic. Based on some criterias, I should prevent the status being changed from active to expired even after the end date. But I don't know the best approach to customize this. I can write a trigger but I just want to know is there a standard way or any declarative way to control the status value? 

 

Thanks in advance,

Sorna

  • January 15, 2013
  • Like
  • 0

Hi,

I have a requirement to post photos from Salesforce static resources into my facebook albums. When i explored, there are lot of options: Facebook toolkit for force.com, faceforce app from appexchange, Facebook graph API, Facebook Javascript SDK, etc.. I am confused with all these options. Could anyone suggest which is the best approach for my requirement (I just need to login, post photos. thats it)?

 

thanks in advance,

Sorna

  • January 09, 2013
  • Like
  • 0

Hi guys,

We have a requirement where business users want to have history tracking for custom settings. From my knowledge it cannot be done. But just want to know if anyone has a workaround for this.

 

Thanks,

Sorna

  • November 01, 2012
  • Like
  • 0

I have enabled feed tracking for some of the Opportunity fields... Is it possible to report on those feeds?

  • August 21, 2012
  • Like
  • 0

I am running a batch apex which involves huge amount of data. The start method queries the data by ascending order of created date and sends it to execute method. But I found in the Apex reference guide that the batches of records are not guaranteed to execute in the order they received from the start method. This messes up the processing of data as I want them to be processed in the ascending of created date. So, is there a way to force the execution to be processed in the same order? Or any suggestions would be appreciated.

 

Thanks in advance,

Sorna

  • June 13, 2012
  • Like
  • 0

We are using a CTI tool called Avaya which is integrated with salesforce and users can call through a soft phone, they will have click to dial functionalities etc...

One of our user's machine freezes when he is in the middle of the call (thru soft phone) and he could not do anything for 5 mins. I guess it is some issue with Avaya softphone. Did anyone used Avaya before? Did anyone encounter this kind of issue?

  • June 06, 2012
  • Like
  • 0

I have detail page button which is basically an onclick javascript. I have to populate some fields and insert a record using this JS code. While doing so, I am getting the following error message when populating one particular pickist field:

{faultcode:'soapenv:client', faultstring:'Missing entity type information. SObject requires a separate type field be sent',}

I am not getting this error message for other picklist fields. I don't know what wrong with this particular one. Any ideas?

  • February 08, 2012
  • Like
  • 0

Hi,

Is there a way to control the sharing settings on Case Comments?

  • December 14, 2011
  • Like
  • 0

In my project, the current sharing model for a case is private. Using sharing rules, the records are shared with some queues. So, if a queue owns a record, all the members of that queue could access the record. 

 

But my requirement is the members of the queue which previously owned the record could also access those records.

 

For instance,

Let's say a case is owned by Queue1 and all of its member can access the record. Now, if the case is transferred to Queue2, then all members of Queue2 could access the case. But all the members of Queue1 should also access the case as Queue1 previously owned the record. 

 

Any ideas/suggestions on how to implement above sharing model would be much appreciated. 

 

 

Thanks,

Sorna

  • December 14, 2011
  • Like
  • 0

Hi,

I am having a VF page which just has an apex:detail tag. So, it is basically a replica of a standard page. But that standard page has an inline VF page and the content height of that inline VF page is uncertain. So, it displays a scroll bar if the content height is longer. 

 

My requirement is to remove the scroll bar and dynamically adjust the height of inline vf page which is a part of apex:detail tag. 

 

Any ideas?

 

 

Thanks,

Sorna

  • December 14, 2011
  • Like
  • 0

Hi All,

We had a lookup relationship between to object and we were copying the owner of the parent to child when ever a new child record got inserted. But if the owner of the parent is an inactive user then the child record cannot be inserted because we were getting the exception "Insert failed. Operation performed with Inactive User".

 

So, then we changed the lookup in to master-detail and now we are able to create a child record for a parent whose owner is inactive. So, I am curious to know what value would be assigned to that child record. But I could neither query the ownerId field for that child object nor find the ownerid field in eclipse. 

 

Do anyone know what Salesforce does with the ownerid field of a child record in a master-detail relationship? And is there a way to query that field?

 

Thanks,

Sorna

  • August 22, 2011
  • Like
  • 0

Hi,

I want to pass a value to a custom picklist field on a standard saleforce page through the URL. So, basically we have to obtain the source id of that field from page source and we can use that id in the URL to map the value. But for a standar field this id will be constant across all the sandbox and prod environments. For ex: let's say for standard Account lookup fields, we have to pass "accid" in the URL. But for a custom field this source id will be different across all environments which force me to hard code those ids in my code and for each sandbox this id is different. Is there a way to avoid hardcoding here?

 

thanks,

Sorna

  • May 31, 2011
  • Like
  • 0

Hi,

 

In our project, we have overridden some of the standard object's new & edit buttons with visualforce pages. Now we have decided to include salesforce mobile into our project scope. And we are testing the app's behaviour in blackberry simulator. But it seems like the overriding feature does not work in mobile (i.e. even though i ve overridden the account's new button with a vf page, in mobile the vf page is not showing up. Instead it is just showing the mobile version of standard account's new page). So, I am wondering whether the "Overridding standard buttons with VF pages" feature is available for mobile or am I missing some configuration setup. Can anyone help me through this?

 

Thanks in advance,

Sorna

  • May 26, 2011
  • Like
  • 0

Hi All,

In Salesforce home page, you could see a calendar which shows your meetings in current month and it has some links at the bottom like "Single User View", "Multi-User View", "Activity List View". My requirement here is to add a new button next to one of these buttons. Is it possible? And also, I want to know how much customizations are allowed with calendar feature in Salesforce. Is this Calendar component is exposed to the API or VF? Could I create a custom Calendar component?

Please share your thoughts.

 

Thanks,

Sorna

  • April 12, 2011
  • Like
  • 1

Hi All,

I am overriding the standard new/edit pages of events with a VF page with all the standard salesforce functionality. So, one of them is adding invitees. Salesforce has their cool related list stuff for invitees in a new event page. But I could not figure out on how to add that functionality in my VF page. Any ideas about this?

 

 

Thanks,

Sorna

  • April 04, 2011
  • Like
  • 0

Hi All,

In Salesforce home page, you could see a calendar which shows your meetings in current month and it has some links at the bottom like "Single User View", "Multi-User View", "Activity List View". My requirement here is to add a new button next to one of these buttons. Is it possible? And also, I want to know how much customizations are allowed with calendar feature in Salesforce. Is this Calendar component is exposed to the API or VF? Could I create a custom Calendar component?

Please share your thoughts.

 

Thanks,

Sorna

  • April 12, 2011
  • Like
  • 1

Hi,

I have to get a cross object field value from sobject. For ex: 

 

Contact c [Select Account.Name from Contact Limit 1];
Sobject s = (Sobject) c;
System.debug('Account Name: '+c.Account.Name);
System.debug('Account Name: '+s.get('Account.Name'));

 In the above code, the 1st debug will work where as for the 2nd debug, it is throwing an error that Account.Name is not a valid for Contact. Any idea on how to get the parent's field values from a SObject?

 

 

Thanks in advance,

Sorna

  • January 21, 2013
  • Like
  • 0

Hi,

 

In my application I have an object namely "Position".

 

In Position object I have a field called Description. This is a text are field.

 

Hereafter I want this description field as Checkbox.

 

If I change the datatype of Description field to Checkbox, data in this field for already created records will be lost.

 

So I have created a new field as Description1 using Checkbox datatype.

 

Now my requirement is,

 

For existing Position records - display the Description field if it has any value and hide Description1. If it doesn't have any value hide Descrption and show Description1. 

 

For new Position records - only display the Description1 field.

 

Position page is standard page not a visualforce page. So I want to do this without using visualforce page.

 

 

Thanks,

Arunkumar

Hello,

 

I am trying to create a simple query involving the account object, and a custom object. But the query causes an error of 

 

"INVALID_TYPE - Didn't understand relationship"

 

The affiliation object is a child relative to Account and both values are strings so I am not sure what the issue is. The query is below.

 

SELECT Name, (SELECT ContactLastName FROM npe5__Affiliation__c) FROM Account

 

 

  • August 28, 2012
  • Like
  • 0

Hi all,

 

I have custom object which is master detail on opportunity. The custom object configured with page layout that has a custom button which on-click goes to VF page. 

 

When I click on "new"  from the custom object related list on opportunity the page does not contain the custom button. However when I click on edit page the button appears. What could be issue

 

Please help.

 

Thanks

Shuba

I have enabled feed tracking for some of the Opportunity fields... Is it possible to report on those feeds?

  • August 21, 2012
  • Like
  • 0

Hi,

 

I observed some odd behaviour while deploying some components from Sandbox to Production.

 

When I logged in as "A" and tried to deploy a change set to my Production environment, I got 21 failures due to classes in the Production envt. Where as when I logged in as "B" and tried to deploy the same changeset I got only 2 errors.

The 2 errors were due to the dependency of a test class in Production(it was querying  an object in the envt, which no longer existed)

So I figured out the problem, corrected it and re-deployed using login "B". The 2 errors vanished and I could deploy successfully.

 

However when I login as "A", I can still see 14 errors (all related to Validation rules). Both "A" and "B" are assigned the same Profile. However Role assigned is different.

 

Can anybody tell me why is the behaviour like this ? Is there any setting that can change the behaviour ?

 

 

Regards,

Lakshmi. 

  • August 20, 2012
  • Like
  • 0

I have rendered a vf page as pdf. I am unable to change the fon-family to arial.

 

I have used

<style type=text/css>

p

{

font-family:"Arial Unicode MS";

font-size:14pt;

}

span

{

font-family:"Arial Unicode MS";

font-size:8pt;

}

h1

{

font-family:"Arial Unicode MS";

font-size:9pt;

}

</style>

<p>some text1</p>

<span>some text2</span>

<h1>some text3</h1>

--- - --  - - -- -  -

- - - - - - - --

But the problem here is am getting a new line everytime I use <p> and <h1> tag.

I dno't want this new line to occur.

Also I tried using <h2>,<h3>,.. , <pre>, <b> and

display:inline;

 

 

How to get the font family as arial without a new line. Also how to make the text bold?

I have tried <b> tag and

font-family:"Arial Unicode MS Bold";

 

Its not working.

 

 

Pls help.

Hi -- I have a custom object, Rev, which is a child of Opportunities and it needs to refer back to the Account that owns the Opportunity. My concern is that there are a whole bunch of Rev components that don't have the Account info populated, and I want to find a way to say:

 

If Rev A belongs to Opp B, and Opp B is owned by Account C, then populate Rev A's accountID field with Account C's ID.

 

Does anyone have an idea of how to do this?

 

Hi,

 

I really need a hand on this, I have been struggling for around 5 hours and I didnt get anything...

 

I had created a custom conversion button on my visualforce page. This button will call a method declared on my leadextension controller. Yesterday it worked without any problem....today I created a few new fields and change the code a bit and didnt work. I made the conversion method as simple as possible because I thought that way I would find my problem. Still getting the same error message...

 

This is the visualforce page where the button is and calls the method:

 

<apex:page standardController="Lead" showHeader="true" extensions="LeadExtension">
    <apex:form >
        <apex:pageBlock title="Account Creation" id="Account_Creation" mode="Read">
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Create Account" action="{!CustomConversion}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:PageBlockButtons>
            <apex:pageBlockSection columns="2">
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Commercial Name"/>
                        <apex:outputLabel value="{!lead.Company}"/>
                    </apex:pageBlockSectionItem>
                    <!--MORE FIELD TO SHOW DECLARE IN HERE-->
              </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 And this id the code of my Class that contains the method:

 

public class LeadExtension {
    public class MyException extends Exception{}
    private Lead l1;
    private Lead l2;
    String result='Click on an account to fetch the data';
        
    public LeadExtension(ApexPages.StandardController stdController) {
       this.l1 = (Lead)stdController.getRecord();
       this.l2= [Select Name,Customer_Connectivity__c,Acquisition_Channel_Description__c, OwnerId, Fiscal_Number_2__c, Fiscal_Number_1__c, 			      Relationship__c,Commercial_Group__c,Commission_Group__c,Fiscal_Name__c,Street_fiscal__c,City_fiscal__c,Post_Code_fiscal__c,Country_Fiscal__c,Province_Fiscal__c,
       			FirstName,LastName,Salutation,Contact_Role__c,Contact_Job_Titel__c,Email,Phone,Contact_Language__c,
       			Currency_to_invoice__c,Billing_Language__c,WhiteLabel_Type__c,Web_Currency__c,RecordTypeId,Website,Number_of_Employees__c,
       			Bank_Name__c,Bank_Account_Number__c,Bank_Account_Holder__c,Bank_Account_Country__c,Routing_Number__c,   			
       			Email_Admin_Finance__c,Fax_Admin_Finance__c,Phone_Admin_Finance__c,First_Name_Admin_Finance__c,
       			Last_Name_Admin_Finance__c,Commercial_Contact_equals_Admin_Contact__c,Web_User_1_Last_Name__c,Web_User_2_Last_Name__c,
       			Web_User_3_Last_Name__c,Web_User_4_Last_Name__c,Web_User_1_Salutation__c,Web_User_2_Salutation__c,Web_User_3_Salutation__c,
       			Web_User_4_Salutation__c,Web_User_1_Name__c,Web_User_2_Name__c,Web_User_3_Name__c,Web_User_4_Name__c,Web_User_Email_1__c,
       			Web_User_Email_2__c,Web_User_Email_3__c,Web_User_Email_4__c From Lead Where (Id=:l1.Id)];
    }
     
    
    public pageReference CustomConversion()
    {
    	/*database.Leadconvert lc = new database.Leadconvert();
    	Database.Leadconvertresult lcr;
    	lc.setLeadId(l2.Id);
    	lc.setConvertedStatus('Converted');
    	lc.setDoNotCreateOpportunity(True);
    	Integer NumErrores=0;
    	String ErrorMessage;
    	
    	lcr=Database.convertLead(lc);
        pageReference pageRef= apexpages.currentPage();//new PageReference('/apex/CustomAccount?id='+lcr.getAccountId());
        return pageRef;*/
        
        Database.LeadConvert lc = new database.LeadConvert();
	lc.setLeadId(l1.id);

	lc.setConvertedStatus('Converted');

	Database.Leadconvertresult lcr=Database.convertLead(lc);
	pageReference pageRef=new PageReference('/apex/CustomAccount?id='+lcr.getAccountId());
	return ApexPages.currentPage();
    }

 And the error message I get is:

------------------------------------------------------------------------------------------------------

Visualforce Error
 


System.DmlException: ConvertLead failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: []

Error is in expression '{!CustomConversion}' in component <apex:page> in page conversionscreen

 

 

Class.LeadExtension.CustomConversion: line 52, column 1

-----------------------------------------------------------------------------------------------------------------

 

The line 52 is the one that says: 

 

Database.Leadconvertresult lcr=Database.convertLead(lc);

 

Really appreciate your help. Regards,

 

Antonio

Hi, I can' t get a simple SOQL query to work, which tries to get all the contacts from a certain account.

Here is my sample code:

 

trigger triggerDNC on Contact (before update) 
{
    //Assign the context before and after the change into a Map
    Map<Id,Contact> newContactMap = Trigger.newMap;
    Map<Id,Contact> oldContactMap = Trigger.oldMap;

    //Loop through the map
    for(Id contactId:newContactMap.keySet())
    {
         Contact myNewContact = newContactMap.get(contactId);
         Contact myOldContact = oldContactMap.get(contactId);
		 
		 // myNewContact.Account.Name DOESNT WORK HERE ?
		 
		 List<Contact> cons= 
              [SELECT Contact.Name, Contact.Phone, Contact.DoNotCall, Contact.Account.Name FROM Contact
                   WHERE Contact.Id!= :myNewContact.Id
                   AND Contact.Account.Id = :myNewContact.Account.Id]; // this doesnt filter out correctly
                         
               for (Contact con: cons) 
               {
                   // con.Account.Name WORKS HERE !!?
               }
                
               update cons;
	} 
}

 I can't access myNewContact.Account.Name or myNewContact.Account.Id, so I can't find a way to get only the contacts from the same account as the one in the trigger.

Any help / feedback would  be greatly appreciated .. thanks.

I've got an SObject that is given to me by a webservice, which I have to update.

Unfortunatly, this object doesn't have an ID because the external service that made the request doesn't have it.

 

I can easily query for the ID, however the ID field is not writable, so I can't just set the sobject's ID and the do an update.

I can't just query the object, then copy over all the fields because I don't know which fields the external service wants me to update (don't want to accidently null out fields).

 

What is the best way to do an update on an object where the ID is known, but is not in the SObject itself?

I have a text_field__c which always ends in 1 or 2 or 3

Eg: Step is 1
    Step is 2
    Step is 3

How can I get the last word i.e 1 or 2 or 3 from the text and then convert the text into integer value?

Is this possible?  

Hello all!

 

This is my first foray into the world of Apex coding. I'm not very famiiliar with coding so appologies in advance for simple errors!

 

I have put the below trigger together piecing various bits of code accross various forums together to trigger an email to the creator of a task on completion if that task is assigned to another person. It works great! However, the user gets two emails each time - is there a way around this? I did a search on the forum and coultn't find a previous thread which shared similat code to my own.

 

Thanks!

 

Louis

 

Here's the code:

 

trigger Trigger_Request_CompletedAfterInsertAfterUpdate on Task (after update)
 {
    
 
   Task[] completedTasks = Trigger.new;
   for(Task t : completedTasks){
      if(t.OwnerId!=t.CreatedById && t.Status=='Completed'){
         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();      

    mail.setTargetObjectId(t.CreatedById);          

    mail.setSubject('Task Completed');        

    mail.setPlainTextBody(Datetime.now().format('MM/dd/yyyy hh:mm a')+' \r\n'+t.Description+' \r\n'+' \r\n'+'Salesforce link: \r\n'+'https://emea.salesforce.com/'+t.AccountId);
    mail.saveAsActivity = false;
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        
      }
   }
}

Hi , i need help in vf page footer alignment

<style type="text/css">
@page
{  

  
    margin: 1cm ; /* All margins set to 1cm */
                   
       @bottom-center 
       {
       font-size:10px;
       content:"This is a Computer Generated Invoice"   
    (How to use break here)hence no signature Required
       } 
}

</style>
</head>

I have text from a textbox in this date format: 'mm/dd/yyyy' and use the following method to parse it:

 

date mydate = date.parse('12/27/2009');

 However when I try to insert the field into the database I get an Invalid Date Format error

 

What am I missing here?

Hi All,

 

Not sure if this is even possible as I have tried and failed miserably.  Is there anyway to access the old and new value fields from the history tables?  I can query the data from the table, but the old / new value fields are never returned:

 

Example

Need to parse and evaluate the expression entered via InputText, user  may enter text as below into the given text Field

 

Opportunity.Amount  * 1.5

 

It should evaluate the value of Opportunity.Amount and also it should perform arithmatic operation.

 

Any help will be appreciated.

 

  • December 21, 2011
  • Like
  • 0

Hi,

Am unable to refresh any of the resources in the IDE from the server.

When am trying to refresh a page from the web, getting an Exception saying:

 

 

Unable to refresh resource 'MileaeExension.cls':
com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

 

Unable to refresh resource 'MileaeExension.cls':


com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

 

Please assist to rectify the issue. 

 

Thanks in advance,

VNath

I'm trying to copy a new user as contact by using a trigger but I'm getting the following error

 

MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User

 

trigger Acceleration_User_Copyto_Contact on User (after insert, after update) {
    
   // Map<String,User> newLead = new Map <String, User>();
    
    system.debug('Acceleration_User_Copyto_Contact Trigger....');
 
    for ( User user : System.Trigger.new)
    {
        if  (user.Email.contains('acceleration'))
        {
            system.debug('Acceleration_User_Copyto_Contact Trigger..2.');
            Integer RecordCount = [select count() from Contact c where c.Email = : user.Email];
            
            system.debug('Acceleration_User_Copyto_Contact Trigger..2a .' + RecordCount);
            
            if (RecordCount == 0)
            {
                String AccountId = '';
                for ( Account a : [Select a.Id From Account a where Name = 'Acceleration']) 
                {
                    system.debug('Acceleration_User_Copyto_Contact Trigger..3.');
                     
                    AccountId = a.Id;
                
                    Contact con = New Contact();
                    con.AccountId = AccountId ;
                    con.Email = user.Email;
                    con.Firstname = User.Firstname;
                    con.Lastname = User.Lastname ;
                    con.User__c = User.Id;
                    insert con;
                }          
            }                   
        }
        
     }
    
    
}