• Jack D Pond
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 8
    Replies

How would I suggest an update to the Documentation.   In Object Reference for Salesforce and Lightning Platform, 46, en.,  User.UserType (and Profile.UserType).

By querying the schema, I can see the following picklist values are available, but this is not what is reflected in the documentation: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_user.htm

Schema: User, UserType Picklist:

  • Standard
  • Partner
  • Customer Portal Manager
  • Customer Portal User
  • Guest
  • High Volume Portal
  • CSN Only
  • Self Service
Hi,

Does anybody have working code to retrieve and upsert picklist value sets ?

Can't get it to work, this is my current code :
 
private GlobalValueSet readGlobalValueSet(String picklist) throws Exception {
		GlobalValueSet values = new GlobalValueSet();
		


			MetadataConnection metadataConnection = sfmcon.getConnection();
			
			ReadResult readResult = metadataConnection.readMetadata("GlobalValueSet", new String[] {picklist});
			//log.info(readResult.toString());
			Metadata[] mdInfo = readResult.getRecords();
			if (mdInfo.length == 1) {
				values = (GlobalValueSet) mdInfo[0];
			}
			else {
				log.info("None or multiple components");		
			}

		
		return values;
	}

readMetadata returns :

[CustomValue [Metadata  fullName='A02'
]
 color='null'
 _default='false'
 description='null'
 isActive='false'
 label='A02'
]
]

The picklist value is active so i would expect :

[CustomValue [Metadata  fullName='A02'
]
 color='null'
 _default='false'
 description='null'
 isActive='true'
 label='A02'
]
]

Later when i execute the upsert with :
 
MetadataConnection metadataConnection = sfmcon.getConnection();
			SaveResult[] results = metadataConnection.updateMetadata(new Metadata[] {repair});

I get the error output :

Error encountered while updating: Application
Error message: CustomField not found.
At the end of the TemperatureConverter example, it says...

"After you run tests, code coverage is automatically generated for the Apex classes and triggers in the org. You can check the code coverage percentage in the Tests tab of the Developer Console. In this example, the class you’ve just tested, the TemperatureConverter class, has 100% coverage as shown in this image."

And it shows an image of 100% 3/3.

However, my code coverage still says 0% & 0/3 even though I was able to successfully replicate the example and had a good TestRun

Any clues as to why that might be? 
Hey all,

I was hoping to get something confirmed. I'm stumped by an issue whereby sharing rules don't seem to be being implemented in a test class.
  • For Contacts, we have a criteria based sharing rule that shares Contacts with a particular group of users if the contact is a particular record type
  • The user group that is shared to is based upon roles within the hierarchy
  • I've written a test class that creates a Contact with the specified record type and runs as a user within the already mentioned group (they have the right role)
  • When running the test as the user, I realised that the user couldn't see the Contacts
  • After trouble-shooting, I queried for the ContactShare records of the Contact and found that the criteria based sharing hasn't been implemented when the Contact was created
Is this a commonly known behaviour?
- If so, that's frustrating as I need to run the test as the user in-order to test other behaviours. Is there a workaround?
- If not, then there may be a problem in my code and I'll double/triple/quadruple check my code to see why the shares aren't being implemented.

With thanks,
Andy

In a pageblock table I want to render more than one records returned by statndardcontroller or extension controoler.

How can I specify the recordId or the record index in pageblock table?

e.g.

 

sr no.                   name                  age              city

1)                          tom                   22               boston

2)                           jim                       33              ny

3)                         shaun                     34               LA

 

I can retrieve name,aga and city.. but my controller can not get record index

i.e 1 for Tom

2 for Jim

3 for shaun etc.

Is there any way to render dynamically in visualforce?

Hello,

 

I have a trigger on Account and it is being called twice I am do not know how to figure this out.

 

Here is my trigger code

 

 

trigger AccUpdateRates on Account (before insert, before update) {
  for(Account a: Trigger. new){
    if(Trigger.isUpdate){
      Account beforeUpdate = System.Trigger.oldMap.get(a.Id);
       if(a.RecordTypeId == '012500000001LcY' && a.Termination_Date__c == null){
        }
     }
     if(Trigger.isInsert){
        if(a.RecordTypeId == '012500000001LcY' && a.product__c != null){
              AccList.add(a);
              prodIDs.add(a.product__c);
          }    
     }
    if(accList.size()>0)
      AccountUpdateRates.UpdateProductRates(AccList, ProdIDs);

   
   }


}

I see that I have Kugadd package installed and have similar trigger on account. 

   Trigger - AccountBeforeInsertBeforeUpdate - installed package Kugamon Account/Contact Sync

 

 

I put print statement in couple of place in my class that is being called from trigger. 

 

When I look at the debug log I see the following statement twice

16:05:48.163|CODE_UNIT_STARTED|[EXTERNAL]|01qP00000004GdG|AccUpdateRates on Account trigger event BeforeUpdate for [0015000000XLDub]

Any suggestions I can find what is my causing trigger to be called twice?

 

Thanks

Uma

Hi,

 

Is there a place where I can see what is the version of my salesforce. Last upgrade...?

 

Thank you.

  • March 08, 2010
  • Like
  • 0

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;
                }          
            }                   
        }
        
     }
    
    
}

 

I have a button on a Contact details page that launches a Visualforce page.  This Visualforce page uses a custom controller for various reasons, but I need to reference the specific Contact that the user launched from.  Is there an easy way to pass the Contact ID as a parameter to the new Visualforce page and reference it throughout my code?

 

Thanks..

I'm writing a VisualForce wizard that collects a list of hardware items (RMA_Return__c) being returned by a customer.  In the VF page, I'd like to control the height and width of the Problem Description field.
 
Picture is worth a thousand words:
 
 
I want to reduce the size of the left InputField box, and increase the width and height of the second InputField box.
 
It looks like <apex:inputText> has a "size" attribute, so you can specify the width of the inputText box, but there isn't a similar attribute for the <apex:inputField> component.
 
There is a "style" attribute, but I'm don't know what CSS syntax would allow me to control this.
 
NOTE:  Still a work in progress, kindly excuse the code hacks here.
 
Current VisualForce Page:
 
Code:
<!-- Create RMA Wizard: Step 2 for Defect / ECO Recall / Shipment Error RMA types -->
<apex:page controller="newRmaController" tabStyle="RMA__c">
  <apex:sectionHeader title="New RMA" subtitle="Step 2 : Select Returning Hardware"/>
  <apex:form >
    <apex:pageBlock title="RMA Detail" mode="edit">
      <apex:pageBlockButtons >
        <apex:commandButton action="{!step1}" value="Previous"/>
        <apex:commandButton action="{!step2}" value="Next"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection title="RMA Information">
        <apex:inputField id="rmaType" value="{!Rma.Type__c}" required="TRUE"/>
        <apex:inputField id="caseNumber" value="{!Case.casenumber}" />
        <apex:inputField id="caseSwitch" value="{!Case.Switch__c}" required="TRUE"/>
        <apex:inputField id="caseAccount" value="{!Case.Accountid}" required="TRUE"/>
      </apex:pageBlockSection>

      <table width="100%"><tr valign="top">
         <td width="70%">
            <apex:pageBlockSection title="List All Returning Hardware and Reason for Return" columns="1">
               <apex:repeat value="{!RMA_Returns}" var="rtn">
                  <tr>
                     <td width="30%"> <apex:inputField value="{!rtn.SN__c}"/> </td>
                     <td witdh="70%"> <apex:inputField value="{!rtn.Problem_Description__c}"/> </td>
                  </tr>
               </apex:repeat>
               <apex:commandLink action="{!addReturn}" value="Add Card"/>
            </apex:pageBlockSection>
         </td>
         <td width="30%">
            <apex:pageBlockSection title="Installed HW as of Last SAT Audit" columns="1">
               <apex:dataTable id="c3HardwareList" value="{!c3HardwareList}" var="hw" bgcolor="#F3F3EC"
                styleClass="list" rowClasses="dataRow" onRowMouseOver="hiOn(this);" onRowMouseOut="hiOff(this);">
                  <apex:column >
                     <apex:facet name="header"><b>S/N</b></apex:facet>
                     <apex:outputLink value="/{!hw.id}">
                        {!hw.name}
                     </apex:outputLink>
                  </apex:column>
                  <apex:column >
                     <apex:facet name="header"><b>Product Code</b></apex:facet>
                        {!hw.Product_Code__c}
                  </apex:column>
               </apex:dataTable>
            </apex:pageBlockSection>
      </td></tr></table>
      <apex:pageBlockSection title="Ship-To Information : Verify with Customer for Accuracy" collapsible="TRUE" columns="2">
          <apex:inputField id="rmaContact" value="{!Switch.RMA_Contact__c}" />
          <apex:inputField id="rmaPhone" value="{!Switch.RMA_Phone__c}" />
          <apex:inputField id="rmaStreet" value="{!Switch.RMA_Street__c}" />
          <apex:inputField id="rmaCity" value="{!Switch.RMA_City__c}" />
          <apex:inputField id="rmaState" value="{!Switch.RMA_State_Region__c}" />
          <apex:inputField id="rmaZip" value="{!Switch.RMA_Zip_Code__c}" />
          <apex:inputField id="rmaCountry" value="{!Switch.RMA_Country__c}" />
      </apex:pageBlockSection>
    </apex:pageBlock>
    Help: http://forums.sforce.com/sforce/board/message—board.id=Visualforce&message.id=668
  </apex:form>
</apex:page>