• Jerun Jose
  • SMARTIE
  • 1289 Points
  • Member since 2011
  • Systems Analyst
  • WIPRO Technologies


  • Chatter
    Feed
  • 44
    Best Answers
  • 1
    Likes Received
  • 2
    Likes Given
  • 27
    Questions
  • 406
    Replies
I have a visualforce page, related to the Opportunity Object.
There is a  lookup field (Influencer1__c), which looksup to the Contact object, name. How can i create another field to show the contacts title?
<td valign="top" width="120"  bgcolor="#DCE1E9"><apex:outputField value="{!StrategicSales__c.Influencer1__c}" > 
  <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" 
    hideOnEdit="editButton" event="ondblclick" 
    changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
      </apex:outputField></td>
Thanks!
 
Hi ,
I need  help in ordering the List. I have a List where the Field Priority__C must be ordered as Primary,Secondary, Tertiary,Fourth,Fifth,Sixth etc.. This order is in another List if Strings. 
The user can change the priority of the record, and after resequencing the priority the order must be same again as Primary, Secondary etc...
I tried ORDER BY Id. But when the priority is changed the Id remains same and so not able to get the ordering.
Please help.
Hello All,
I'm attempting to write a class that will allow me to take AggregateResults from two unrelated objects and list them on a visualforce page for display and charting. I understand that I will need to use a wrapper class to accomplish this, but for the life of me, I can’t get it to work the way I expect. Although I am getting the information to pass to my visualforce page, when displayed, it shows the entire list in one column as opposed to being iterated. I have been reading the docs for a while now and can’t seem to find out what I’m doing wrong. Any guidance would be greatly appreciated

Apex:
public class ErrorTableClass3 {
    
	public ErrorTableClass3(){
        getWrapperC();
    }
    
    public list<WrapperClass> ErrorTable {get; set;}
    
    public class WrapperClass{
    	public list<integer> Mem {get; set;}
        public list<integer> Err {get; set;}
        public list<string> Errmon {get; set;}
        public list<string> MemMonth {get; set;}
            
        public WrapperClass (list<string> ErrorMonth, list<string> Memmonth, list<integer> Memberships, list<integer> Errors){
            Mem = Memberships;
            Err = Errors;
            ErrMon = ErrorMonth;
            MemMonth = MemMonth;
        }     
    }
  
    Public list<WrapperClass> getWrapperC(){

        list<AggregateResult> MembershipAggList = new list<AggregateResult>([SELECT SUM(New_Memberships__c) Memberships, Calendar_month(event_date__c) EventMonth FROM Campaign WHERE Facilitated_By_MD__C = '005i0000000z0nW'GROUP BY Calendar_month(event_date__c )]);  
        list<AggregateResult> ErrorAggList = new list<AggregateResult>([SELECT count(ID) Errors, Calendar_month (App_sign_Date__c) Datemonth FROM Missing_Info_Errors__C WHERE Officer__c = 'John Smith' AND App_Sign_Date__c = THIS_YEAR GROUP BY Calendar_month(App_Sign_Date__c)]);
        
       	list<integer> MembershipIntList = new list<integer>();
        list<string> MemMonth           = new list<string>();
        list<string> ErrorMonth         = new list<string>();
        list<integer> ErrorIntList      = new list<integer>();
		list<WrapperClass> ErrorTable = new list<WrapperClass>();
        
        for(AggregateResult m : MembershipAggList){
        	MembershipIntList.add(integer.valueOf(m.get('Memberships')));
            MemMonth.add(string.valueOf(m.get('EventMonth')));
       	}
        
        for(AggregateResult e : ErrorAggList){
        	ErrorIntList.add(integer.valueOf(e.get('Errors')));
            ErrorMonth.add(string.valueOf(e.get('DateMonth')));
        }
        

        ErrorTable.add(new WrapperClass(ErrorMonth, MemMonth, MembershipIntList, ErrorIntList));
            return ErrorTable;
        
    }
   
}
Markup:
<apex:page controller="ErrorTableClass3">
    <apex:pageBlock >
			<apex:pageBlockTable value="{!WrapperC}" var="e">
                <apex:column headerValue="Errors" footerValue="Total" value="{!e.Err}" />
                <apex:column headerValue="Memberships" footerValue="Total" value="{!e.Mem}" />
                <apex:column headerValue="Month" footerValue="Total" value="{!e.ErrMon}" />
            </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

Result Screenshot
User-added image

 

Hi,

 

I'm working on a trigger to call a class which assigns an Entitlement on Cases according to the Priority and Account on the case. The trigger and class both work for cases created internally, but won't work for customers through the customer portal. Below are the triggers and class involved. The customer portal profiles have Read access for the Entitlement object. Any help would be greatly appreciated!

 

trigger AssignEntitlementTrigger on Case (before insert){

    Case[] cases = trigger.new;
    List<Id> CaseAccounts = new List<Id>();
    List<Entitlement> EntitlementToAdd = new List <Entitlement>();
    Case cA = cases[0];
      if(cases[0].Priority == 'Critical'){
            EntitlementToAdd = [Select Id From Entitlement 
                                    Where AccountId = :cA.AccountId and 
                                    Entitlement.Support_process__c = 'Critical' 
                  limit 1];
//                trigger.new[0].Action_needed_by__c = 'BigMachines';
        }
      else if(cases[0].Priority != 'Critical'){            
            if(cases[0].Support_Product__c == 'Premium'){
                   
              EntitlementToAdd = [Select Id From Entitlement 
                                    Where AccountId = :cA.AccountId and Entitlement.Support_Process__c = 'Premier'
                                    limit 1];
//                   trigger.new[0].Action_needed_by__c = 'Customer';
            }
        else {               
            EntitlementToAdd = [Select Id From Entitlement
                                Where AccountId = :cA.AccountId and Entitlement.Support_Process__c = 'Standard'
                                limit 1];
//         trigger.new[0].Action_needed_by__c = 'User';
        }
       }
    
    if(EntitlementToAdd.isEmpty() == false){
        AssignEntitlementOnCase.assignEntitlement(cases, EntitlementToAdd);
        }
//        trigger.new[0].Action_needed_by__c = '3rd Party';
}

 

 

public class AssignEntitlementOnCase{

    public static void assignEntitlement(List<Case> cases, List<Entitlement> EntitlementToAdd) {
        List<Case> CasesToUpdate = [Select Id, EntitlementId From Case cases Where EntitlementId = null limit 3];
        if(CasesToUpdate.isEmpty() == false){
            for(Case c : cases){
            c.EntitlementId = EntitlementToAdd[0].Id;
            }
        }
    }
}

 

 

 

If Book_Category__c == 'Fiction', I want the text field Book_Code__c to be required else not required.

How can I make the red bar appear and disappear?

 

I think i am missing the render , can someone please help?

 

 

 

<apex:page standardController="Book__c">
<apex:form>
<apex:pageBlock >

    <apex:pageBlockSection>
        <apex:pageBlockSectionItem>
            <apex:outputPanel>
                  <apex:outputLabel value="Book Category" />
                  <apex:inputField value="{!Book__c.Book_Category__c}"/>
            </apex:outputPanel>
        </apex:pageBlockSectionItem>
    </apex:pageBlockSection>


  
  <apex:pageBlockSection>
        <apex:pageBlockSectionItem>
            <apex:outputPanel>
                <div class="requiredInput">
                    <div class="requiredBlock"></div>
                    <apex:outputLabel value="Cost Code" />
                  <apex:inputField value="{!Book__c.Cost_Code__c}" required="{!IF(Book__c.Book_Category__c =='Fiction', true, false)}" />
                </div>
            </apex:outputPanel>
        </apex:pageBlockSectionItem>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>

 

Hi All 

     I am trying to write a test class for this apex class and VF page but im getting this error 

System.NullPointerException: Attempt to de-reference a null objectStack TraceClass.Custom_Account_Lookup_Search.saveAccount: line 42, column 1
Class.Test_Custom_Account_Lookup_Search.test1: line 24, column 1

 how to solve this issue;

 

Test Class:

@isTest(Seealldata = true)
public class Test_Custom_Account_Lookup_Search
{
 Static testmethod void test1()
 {
    PageReference pg = page.Custom_Account_Lookup_Search_page;
    Test.setcurrentPage(pg);    
    //account a = new Account( name='foo' ,BillingStreet ='west',BillingCity ='test') ;
     //insert a;
     Account acc = new Account();
     acc.Name='voltum';
     acc.BillingStreet='Santhom High Road';
     acc.BillingCity='Chennai';
     acc.BillingState='TamilNadu';
     acc.BillingCountry='India';
     //acc.BillingZipPostal='6000028';
     acc.Email__c='perisoft@voltum.com';
     acc.Fax='+49 9134 85 28732';
     acc.Website='http://www.voltum.com.au/';
   insert acc;
     Site__c site = new Site__c();
     ApexPages.StandardController stdController1 = new ApexPages.StandardController(site); 
     Custom_Account_Lookup_Search thecontroller1 = new Custom_Account_Lookup_Search(stdController1);
     thecontroller1.saveAccount();
     
   }
}

 

Aex class:

public with sharing class Custom_Account_Lookup_Search {

public Account account {get;set;} // new account to create
public List<Account> results{get;set;} // search results
public string searchString{get;set;} // search keyword

public Custom_Account_Lookup_Search() {
account = new Account();
// get the current search string
searchString = System.currentPageReference().getParameters().get('lksrch');
runSearch();
}

// performs the keyword search
public PageReference search() {
runSearch();
return null;
}
public Custom_Account_Lookup_Search(ApexPages.StandardController stdController)
{
}
// prepare the query and issue the search command
private void runSearch() {
// TODO prepare query string for complex serarches & prevent injections
results = performSearch(searchString);
}

// run the search and return the records found.
private List<Account> performSearch(string searchString) {

String soql = 'select id, name from account';
if(searchString != '' && searchString != null)
soql = soql + ' where name LIKE \'%' + searchString +'%\'';
soql = soql + ' limit 25';
System.debug(soql);
return database.query(soql);

}

// save the new account record
public PageReference saveAccount() {
insert account;
// reset the account
account = new Account();
return null;
}

// used by the visualforce page to send the link to the right dom element
public string getFormTag() {
return System.currentPageReference().getParameters().get('frm');
}

// used by the visualforce page to send the link to the right dom element for the text box
public string getTextBox() {
return System.currentPageReference().getParameters().get('txt');
}

}

 

VF Page:

<apex:page controller="Custom_Account_Lookup_Search"
title="Search"
showHeader="false"
sideBar="false"
tabStyle="Account"
id="pg">

<apex:form >
<apex:outputPanel id="page" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
<apex:tabPanel switchType="client" selectedTab="name1" id="tabbedPanel">

<!-- SEARCH TAB -->
<apex:tab label="Search" name="tab1" id="tabOne">

<apex:actionRegion >
<apex:outputPanel id="top" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
<apex:outputLabel value="Search" style="font-weight:Bold;padding-right:10px;" for="txtSearch"/>
<apex:inputText id="txtSearch" value="{!searchString}" />
<span style="padding-left:5px"><apex:commandButton id="btnGo" value="Go" action="{!Search}" rerender="searchResults"></apex:commandButton></span>
</apex:outputPanel>

<apex:outputPanel id="pnlSearchResults" style="margin:10px;height:350px;overflow-Y:auto;" layout="block">
<apex:pageBlock id="searchResults">
<apex:pageBlockTable value="{!results}" var="a" id="tblResults">
<apex:column >
<apex:facet name="header">
<apex:outputPanel >Name</apex:outputPanel>
</apex:facet>
<apex:outputLink value="javascript&colon;top.window.opener.lookupPick2('{!FormTag}','{!TextBox}_lkid','{!TextBox}','{!a.Id}','{!a.Name}', false)" rendered="{!NOT(ISNULL(a.Id))}">{!a.Name}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:outputPanel>
</apex:actionRegion>

</apex:tab>

<!-- NEW ACCOUNT TAB -->
<apex:tab label="New Account" name="tab2" id="tabTwo">

<apex:pageBlock id="newAccount" title="New Account" >

<apex:pageBlockButtons >
<apex:commandButton action="{!saveAccount}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageMessages />

<apex:pageBlockSection columns="2">
<apex:repeat value="{!$ObjectType.Account.FieldSets.CustomAccountLookup}" var="f">
<apex:inputField value="{!Account[f]}"/>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>

</apex:tab>
</apex:tabPanel>
</apex:outputPanel>
</apex:form>
</apex:page>

 

Hello:

 

I do a monthly Upsert via bulk upload (Apex Data Loader) of records on custom object Subscriber__c.

 

What I want to do is once the upsert is complete, delete any records that were not created or updated during he bulk Upsert process.

 

Here is the trigger I have written - and I am aware this may be terrible or not even close to what I need :)

 

trigger DeleteSubs on Subscriber__c(after insert, after update) {
 List<Id> lstId = new List<Id>();
 
for(Subscriber__c sub: Trigger.old){
        List<Subscriber__c> nolongersubs = [Select Id from Subscriber__c where LastModifiedDate<TODAY];
        delete nolongersubs;
    }
 
}

 When trying to insert a single record I am getting execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object:Trigger.DeleteSubs: line 4, column 1

 

Any help would be greatly appeciated.

 

Thanks,

 

Hampton

 

 

Hi,

 

In Service Console, I have created a custom button in lead detail page. On click of that button, I need to open a Service Console subtab(passing the lead Id). Please let me know how to achieve this. I dont know much about Service Cloud.

Its very urgent, so a immediate response is very very helpful to me.  Thanks a lot.

 

--Jaya.

I'm having trouble with the following code.  I keep getting the error that there is no viable alternative on the "for(integer i...) line.  

 

 

trigger recipTechSurvey on Tech_Survey__c(after update, after insert){
List<Show__c> linkedShows = [SELECT id, Tech_Survey__c FROM Show__c WHERE Show__c.id IN :Trigger.newMap.keySet()];

 

for (Integer i = 0; i < Trigger.new.size(); i++) {
List<Show__c> showsToUpdate = new List<Show__c>{};
for(List <Show__c> ls: linkedShows, ){
             if (Trigger.new[i].ShowNum__c == ls.id) {
             ls.Tech_Survey__c= :Trigger.new[i].id; 
             showsToUpdate.put(ls.id, ls.Tech_Survey__c);
}
              } 

Database.update(showsToUpdate);
}


 
static testMethod void testrecipTechSurvey(){ Show__c show = new Show__c(name='testShow', Show_Num__c='14-2000'); insert show; Show__c setShow = [SELECT Id, Show_Num__c FROM Show__c WHERE Show_Num__c='14-2000']; Tech_Survey__c survey = new Tech_Survey__c(ShowNum__c=setShow.id); insert survey; Show__c s = setShow; System.assertEquals (s.Tech_Survey__c, setShow.id); } }

 

 

Hi All-

 

Is it possible to update text field with image using apex trigger?
Something like , Account.field=IMAGE(' image location');

if not,then is there any other way? I think workflow field update has similar limitation,i.e., I can not update field with image.

I am reaching the character limit in formula so not able to use it.

Thanks,

Sam

I have two  fiellds on object   Colors    ,   Rejection Reason

 

Colors is MULTISELECT picklist

 

Rejection Reason  is just a picklist 

 

 

Whenever the colors B,C,D,E,F,G  in any combination are selected  Rejection Reason field is mandatory

 

Whenever the color A is selected Rejection Reason is not mandatory

 

 

Whenever the color A is selected along with B,C,D,E,F,G   (any combination as it is a multi select picklist )  Rejection Reason is not mandatory

 

 

Colors has the following values                                                    

A, B ,C ,D,E,F,G ,H      

 

 

I am able to get through all scenarios except the third  

 

 

Can anybody please be a life saver for me                                                                         

I am trying to update a field on the account that comes from a case. This trigger should look at all cases related to the account and determine if there is and R/Y/G string. If there is R it should set the account field to R, if there is no R and no G it should set it to Y and if the default would be G. I have worked on this for hours - I am new to this and I just don't know enough to get it to work. I have posted this on both here and the stack exchange. Thanks in advance for any help. Let me know if you need more detail.

 

trigger CaseStatusUpdate on Case (after update, after insert) {
List<ID> AccIDs = new List<ID>();
List<Account> updateAccList = new List<Account>();
For( Case c1 : Trigger.New){
 AccIDs.add(c1.AccountId);
}
Map<ID,Account> AccUpdateMap = new Map<ID,Account>();
for(Account acc : [Select ID , AccCaseStatusCalcGRY__c from Account where ID in:AccIDs])
{
 AccUpdateMap.put(acc.ID ,acc );

}
For(Case c1: Trigger.New){
Account updateacc =AccUpdateMap.get(c1.AccountID);
if (c1.CaseStatusCalcGRY__c == 'R') {
    updateacc.AccCaseStatusCalcGRY__c = 'R';
} else if (c1.CaseStatusCalcGRY__c != 'R' && c1.CaseStatusCalcGRY__c != 'G') {
    updateacc.AccCaseStatusCalcGRY__c = 'Y';
} else {
    updateacc.AccCaseStatusCalcGRY__c = 'G';
updateAccList.add(updateacc);
}
if(updateAccList!=null && updateAccList.size()>0)
update updateAccList;
}
}

 

We are using Question and Answers in our customer portal and would like email notifications similar to Salesforce Success' question/answer boards.

 

I was able to create a trigger that would send email to the clients involved in the discussion whenever a new reply/answer was added however the only issue I am having is that the email is sent on behalf of the client that posted the reply/answer.

 

In outlook it appears like this:

 

noreply@salesforce.com; on behalf of; Customer Portal <client@clientcompany.com>

 

I do not wish to expose our clients email address to each other, is there a way to send emails from apex code using the same on behalf of every time such as noreply@mycompany.com?

 

Thanks,

Jimmy

Hello All,

 

when i try to cover the below code in the test class. The only first if condition is getting covered and it is not checking or covering the second if condition even if i write another test method in the test class.


And if i remove the return null statement and run the test class, it is covering all the blocks. But the condition is not validating (i.e., not giving any page message) and bypassing the conditions.

 

Can anyone give me an immediate reply. Would be very helpful.

 

public pagereference insertPayInfo(){

             if(creobj.CC1_Apartment__c=='' || creobj.CC1_Apartment__c == null)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Fatal,'Please Input Postal Code'));
                return null;
            }   
            if(creobj.CC1_City_Town__c=='' || creobj.CC1_City_Town__c == null)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Fatal,'Please Input City or Town'));
                return null;
            }  

pagereference pgref=new pagereference('www.salesforce.com');
return pgref;

}

 

 

Thanks,

Uday

  • March 22, 2013
  • Like
  • 0

The following code:
Customer Name<apex:inputField value="{!Customer__c.Name}"

Displays the input field below 'Customer Name' and not side by side as expected.
Any clue, Why it is doing that?

Hi,

I am using person account. I am trying to differentiate person account and business account by using auto number, Person account will have auto number as APP-0001 and business account will have BA-0001.

Can anyone give a good solution for this in the form of a trigger or any other solution is greatly appreciated.

Hello,

 

Can someone tell me,

what's the difference or feature between Data Loader and apex batch class??

 

Why to use batch class when we are able to do it with dataloader settings (i.e migrating the data in batches)

 

 

Thanks in advance

Hi

 

I'm trying to use a function call to return a new email file attachment (I'm calling the subroutine from a few different places within the same batch class).  However, I'm getting a compilation error: invalid constructor name: EmailFileAttachment.  Does this mean I cannot return a Messaging.EmailFileAttachment constructor from a function, or am I doing something wrong?

 

private Messaging.EmailFileAttachment (Attachment AttachRec)
{
    // Create the mail message attachment
    Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
    attach.setContentType(AttachRec.ContentType);
    attach.setFileName(AttachRec.Filename);
    attach.setInline(false);
    attach.Body = AttachRec.body;
    return attach;
}

 

Many thanks in advance!

 

Martin

I am trying to get the account and contact based on the portal user and is running the apex code.  I can get the user id using :

 

user uid = [select id from user where id = :UserInfo.getUserId()];

 

but when I add contact to that I get an error " No such column 'Contact' on entity 'User'" even though when I open the user object it has a lookup field called contact.  Any idea how to get the contact and account?

Hi,  I am implementing future method for a requirement . I want to pass parameters to it from a trigger. I know only primitive data types and collections of primitive data types can be passed .

 

So, When I pass Map<Id,Id> it works fine but when I pass MAP<Id,SET<Id>> I get the error

 

'Save error: Unsupported parameter type MAP<Id,SET<Id>>'

 

Does this means I cannot pass any collection containing a collection of Id?

 

I cannot find any documentation on this. If anyone of you has faced this issue. Please confirm.

I have a controller variable of time datatype.
public Time startTime{get;set;}

startTime = Time.newInstance(12,0,0,0);
Rendering the variable as is on visualforce will output as 12:00:00.000Z

I want to display this on a visualforce page in a proper time format using the outputText parameter passing technique.
I tried 
 
<apex:outputText value="{0, time, h:mm a}">
     <apex:param value="{!slot.startTime}" /> 
</apex:outputText>
I'm getting a compile time error "The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.". Anybody knows the correct syntax to get this working.

I know we can convert this variable as a datetime variable and use that instead, but wondering why Time variable does not work.

 

I'm looking to construct a regex which will help me identify the first occurrence of a match.

My current regex is "(.*)[Cc][Aa][Ss][Ee][^a-zA-Z\\d]*(\\d\\d*)[^a-zA-Z\\d]*(.*)"

 

What I am trying to do is to find if the input string contains the word "case" (case insensitive), followed by any number of special characters, followed by a number; I want to retrieve 3 parts of the text.

 

Say my input string is "RE: FW: case:-1234: there is some description"

Using this regex, I am able to retrieve, "RE: FW: ", "1234", "there is some description".

 

This is fine, but if my input string is "RE: FW: case:-1234: This is in reference to case 789 reopening"

 

Then my regex returns, "RE: FW: case:-1234: This is in reference to", "789", "reopening".

 

What I would like to get is "RE: FW: ", "1234", "This is in reference to case 789 reopening".

Hi,

 

We have a simple custom button that executes an on-click Javascript code.

 

var openSubtab = function openSubtab(result) {
	targetURL='/_ui/core/email/author/EmailAuthor?isdtp=vw';
	javascript&colon;sforce.console.openSubtab(result.id,targetURL, true, 'Send Email');
};

var callOpenSubtab = function callOpenSubtab(result){
	sforce.console.getEnclosingPrimaryTabId(openSubtab);
};
sforce.console.getEnclosingPrimaryTabId(callOpenSubtab);

 This code works on normal execution. However, if I delete a related record for a case and then click this button, I get the error 'Registry is undefined'.

 

Anybody who can explain or help me understand this??

 

  1. Create a workflow rule with eval criteria as 'Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria' and Rule Criteria is "Case: Status equals New". The value can be anything actually. Set the workflow action to update a field value (for easy inspection)
  2. Update any attribute on the case. Anything but the case contact or the case status. You will notice that workflow was not fired (as expected). Inspecting the debug logs you will see that the WF_RULE_NOT_EVALUATED (again as expected).
  3. Update only case contact. You will now notice that the workflow rule has fired.(This should not be as we have not changed the case status)

I feel this is a bug. Please try it out and tell me if you can explain this.

Hi,

 

Can someone help me out with Metadata API ? I need to figure out a way to change values for a picklist field using apex. I thought that an update() call using the Metadata API should be the right direction, but having a hard time putting together the format of the request.

Also, can we do picklist value changes in Production using the update() call? Based on the post at
http://boards.developerforce.com/t5/Apex-Code-Development/CRUD-based-development-Metadata-API/m-p/193777#M32258
I believe we will need a deploy() call for any deployment to production.

Hi,

 

I have a narrow home page component which contains javascript in a HTML area section.

I'm looking for a way to get the current user details in this javascript. I need this to identify the current user's profile ID and perform some DOM manipulation. I have the code for performing the DOM manipulation. I am not able to however get the current user details. The normal merge field approach of {!$User.ID} does not work.

 

<script>
	var usr = // some way to get the current user ID.
</script>

 Any help is appreciated.

 

 

Hi,

 

Is it possible to embed a visualforce page from a managed package in our own custom visualforce page?

I am trying to use the apex include tag to reference a visualforce page from a managed package. I am not able to save the page, as I get the error that the controller is not visible.

<apex:include pageName="Namespace__VFPageName"/>

 
Is there some other way to do it?

Hi,


I am trying to insert a pipe symbol in a string for using the google chart apis. Unfortunately, SFDC is replacing the | symbol with &#124;
Is there a way that we can have a string which includes the | symbol?
 
Doing system.debug('|'); in the developer console displays the output as
USER_DEBUG|[1]|DEBUG|&#124;
 
Any help is appreciated.

Hi,

 

Is there a way to be able to pass values from the execute method to the finish method.


I think this can be done using the database.stateful interface, but I do not need to maintain state of all the variables that I am using in my execute method. I only need to use one ID value which will be identified using my execute methods.

 

Please let me know if there is someway of doing this.

Hi,

 

I'm trying to simulate the alphabet search functionality available in standard list views. I have been able to get most of the work done by using an SOQL query with filters for field1 like '%A'

 

 

But I do not know how to work the 'Other' filter on the alphabet search. This filter will present you all the records that start with a number or special character. How can we issue a SOQL query which does something similar?

I ran into a problem today, when my test classes were not acting stable.

 

Thing is, when I ran the testmethod first, it succeeded; a few hours later it failed; a few more hours later it succeeded again. All the while nothing was changed in the org, and my test method or target classes do not have any time dependant logic. Any possible reasons for this strange behaviour?

 

Another thing I noticed was that when I click on the % value to show up the lines covered, some lines had no highlight. Can some1 tell me what they mean ?

 

 

Thanks,

 

Jerun Jose

Hi,

 

I have a requirement where I need to send an email to the Opportunity owner and some sales team members (defined by the team role).

 

Is it possible to use an email template while doing this? I was able to do something similar using a workflow email alert, but this time, I need to send the email through Apex.

 

Any help is appreciated.

 

Thanks,

 

Jerun Jose

Hi,

 

I have a somewhat strange situation.

I have a validation rule say V1 setup on the Opportunity object that work as expected. This validation checks if some Account fields are filled in for any Closed-Won opportunity.

 

I also have a visualforce page that is used to move the Opportunity stage to Closed Won. In that page, I want to display the error message from V1 rule if the rule formula fails. I cant use a try catch block because, before some integration is involved before the update and the missing data corrupts the other system data.

So basically, is there some describe method or something where we can access the Validation rule metadata and get the error message. The reason I want the error message from the rule is because it comes with the translations as well. I dont mind recoding the validation formula, but I am keen in accessing the translated error messages.

 

Thanks,

 

Jerun Jose

Hi,

 

I am using a visualforce page in my project which also display some error messages to the users. I want to know if it is possible to change the text of the error message based on the current user's locale. Can we leverage the translational workbench for this? I'm guessing that

 

All inputs are welcome.

 

Thanks,

 

Jerun Jose

 

Hi,

 

I am working on a visualforce page which is used to integrate SFDC data with an external system.

The integration process involves multiple callouts (about 5) which can take up a lot of time. Is it possible to update the visualforce page to display the status of the transaction?

 

Say if the method which is called from the page is

public someReturn someMethod(){
	method1();
	// say status is s1
	method2();
	// say status is s2
	method3();
	// say status is s3
	method4();
	// say status is s4
	method5();
	// say status is s5
}

 How can we display the status of the method 'someMethod' to update the page with the statuses s1, s2 ..

 

Any suggestions are welcome.

 

Thanks,

 

Jerun Jose

Hi,

 

As of Spring 12 release, test methods by default do not have access to the org's data.

For this purpose, I inserted custom setting data in my test method. However, I am having trouble accessing them.

 

The puzzling thing is that CustomSettting.getAll() works but CustomSettting.getValues('value1') does not.

 

Below is a piece of the code from the test method.

system.debug('@@@@@@@@@@ CConList = '+CConList);
system.debug('@@@@@@@@@@ CRO_Constants__c.getAll() = '+CRO_Constants__c.getAll());
system.debug('@@@@@@@@@@ CRO_Constants__c.getAll().get() = '+CRO_Constants__c.getAll().get('Account Record Type'));
system.debug('@@@@@@@@@@ CRO_Constants__c.getValues = '+CRO_Constants__c.getValues('Account Record Type'));
system.debug('@@@@@@@@@@ CRO_Constants__c.getInstance = '+CRO_Constants__c.getInstance('Account Record Type'));

 The debug for this is as below.

 

14:16:31.185 (2185341000)|USER_DEBUG|[75]|DEBUG|@@@@@@@@@@ CConList = (CRO_Constants__c:{Name=Account Record Type, Id=a1tL00000004CkKIAU, Value__c=01220000000E1rrAAC}, CRO_Constants__c:{Name=Contact Record Type, Id=a1tL00000004CkLIAU, Value__c=012200000009cEAAAY}, CRO_Constants__c:{Name=Product Record Type, Id=a1tL00000004CkMIAU, Value__c=012200000009cEEAAY}, CRO_Constants__c:{Name=Standard PriceBook, Id=a1tL00000004CkNIAU, Value__c=01s2000000008FW}, CRO_Constants__c:{Name=CRO PriceBook, Id=a1tL00000004CkOIAU, Value__c=01sL0000000CpIEIA0})

14:16:31.196 (2196917000)|USER_DEBUG|[76]|DEBUG|@@@@@@@@@@ CRO_Constants__c.getAll() = {Account Record Type=CRO_Constants__c:{Name=Account Record Type, SetupOwnerId=00DL000000092uI, CurrencyIsoCode=PicklistData: USD, LastModifiedById=005D00000025yYr, SystemModstamp=2012-03-08 08:46:29, CreatedById=005D00000025yYr, CreatedDate=2012-03-08 08:46:29, LastModifiedDate=2012-03-08 08:46:29, IsDeleted=false, Value__c=01220000000E1rrAAC, Id=a1tL00000004CkK}, CRO PriceBook=CRO_Constants__c:{Name=CRO PriceBook, SetupOwnerId=00DL000000092uI, CurrencyIsoCode=PicklistData: USD, LastModifiedById=005D00000025yYr, SystemModstamp=2012-03-08 08:46:29, CreatedById=005D00000025yYr, CreatedDate=2012-03-08 08:46:29, LastModifiedDate=2012-03-08 08:46:29, IsDeleted=false, Value__c=01sL0000000CpIEIA0, Id=a1tL00000004CkO}, Contact Record Type=CRO_Constants__c:{Name=Contact Record Type, SetupOwnerId=00DL000000092uI, CurrencyIsoCode=PicklistData: USD, LastModifiedById=005D00000025yYr, SystemModstamp=2012-03-08 08:46:29, CreatedById=005D00000025yYr, CreatedDate=2012-03-08 08:46:29, LastModifiedDate=2012-03-08 08:46:29, IsDeleted=false, Value__c=012200000009cEAAAY, Id=a1tL00000004CkL}, Product Record Type=CRO_Constants__c:{Name=Product Record Type, SetupOwnerId=00DL000000092uI, CurrencyIsoCode=PicklistData: USD, LastModifiedById=005D00000025yYr, SystemModstamp=2012-03-08 08:46:29, CreatedById=005D00000025yYr, CreatedDate=2012-03-08 08:46:29, LastModifiedDate=2012-03-08 08:46:29, IsDeleted=false, Value__c=012200000009cEEAAY, Id=a1tL00000004CkM}, Standard PriceBook=CRO_Constants__c:{Name=Standard PriceBook, SetupOwnerId=00DL000000092uI, CurrencyIsoCode=PicklistData: USD, LastModifiedById=005D00000025yYr, SystemModstamp=2012-03-08 08:46:29, CreatedById=005D00000025yYr, CreatedDate=2012-03-08 08:46:29, LastModifiedDate=2012-03-08 08:46:29, IsDeleted=false, Value__c=01s2000000008FW, Id=a1tL00000004CkN}}

14:16:31.201 (2201417000)|USER_DEBUG|[77]|DEBUG|@@@@@@@@@@ CRO_Constants__c.getAll().get() = CRO_Constants__c:{Name=Account Record Type, SetupOwnerId=00DL000000092uI, CurrencyIsoCode=PicklistData: USD, LastModifiedById=005D00000025yYr, SystemModstamp=2012-03-08 08:46:29, CreatedById=005D00000025yYr, CreatedDate=2012-03-08 08:46:29, LastModifiedDate=2012-03-08 08:46:29, IsDeleted=false, Value__c=01220000000E1rrAAC, Id=a1tL00000004CkK}

14:16:31.201 (2201558000)|USER_DEBUG|[78]|DEBUG|@@@@@@@@@@ CRO_Constants__c.getValues = null

14:16:31.201 (2201676000)|USER_DEBUG|[79]|DEBUG|@@@@@@@@@@ CRO_Constants__c.getInstance = null

 Can someone explain me why I am getting null when using getValues and getInstance methods?

 

Thanks,

 

Jerun Jose

Hi,

 

I am using a trigger to show error messages. The requirement is to write the error event into an error object whenever the error occurs.

 

The problem I am having is that whenever I throw an error message, that transaction is treated as an exception and any writes to the DB in that transaction are rolled back.

 

So, the debug logs show one record is inserted, but I guess that is then rolled back. Any ideas on how we can achieve this ?

 

Thanks,

 

Jerun Jose

 

 

Hi,

We have a requirement to update the account owner using apex.
After identifying the user who should be the new account owner, I need to verify if that user has a profile that has read access to the Account object.
Through the API, the system allows me to specify any user (even inactive users) as the account owner.
For custom objects however, when I specify an inappropriate user as the record owner, the system throws an exception.


Any help on how to validate the account owner's permission before assigning ownership would be appreciated.

Thanks,

Jerun Jose

Hi,

 

I am trying to pull data from MS Access DB and insert into Salesforce. I was having trouble in getting the configuration done.

 

I tried to make it very simple, and created a database TestDBForCLI.mdb with one table TestTable. This table has only two columns and currently only 1 row of data. I am still getting the error message:

  Sql error: Invalid Fetch Size.

 

Process-conf.xml

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="AccessPullProcess"
          class="com.salesforce.dataloader.process.ProcessRunner"
          singleton="false">
        <description>AccountMaster job gets the Customer record updates from ERP (Oracle financials) and uploads them to salesforce using 'upsert'.</description>
        <property name="name" value="AccessPullProcess"/>
        <property name="configOverrideMap">
            <map>
	<entry key="sfdc.debugMessages" value="true"/>
                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\accountMasterSoapTrace.log"/>
                <entry key="sfdc.endpoint" value="https://login.salesforce.com"/>
                <entry key="sfdc.username" value="myUserName"/>
                <entry key="sfdc.password" value="myPassword"/>
	<entry key="sfdc.proxyHost" value="myProxy"/>
        	<entry key="sfdc.proxyPort" value="8000"/>
	<entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="process.operation" value="insert"/>
                <entry key="process.mappingFile" value="C:\Documents and Settings\jerun\Desktop\Developer\DataLoader\Jerun\AccMap.sdl"/>
	<entry key="dataAccess.name" value="queryAcc"/>
                <entry key="dataAccess.type" value="databaseRead"/>
                <entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800"/>
            </map>
        </property>
    </bean>
</beans>

 

Database-conf.xml

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
	<bean id="queryAcc" class="com.salesforce.dataloader.dao.database.DatabaseConfig" singleton="true">
		<property name="sqlConfig" ref="AccountPull"/>
		<property name="dataSource" ref="connectionParams"/>
	</bean>
	<bean id="connectionParams" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
		<property name="driverClassName" value="sun.jdbc.odbc.JdbcOdbcDriver"/>
		<property name="url" value="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\Documents and Settings\jerun\Desktop\Developer\DataLoader\Jerun\TestDBForCLI.mdb"/>
		<property name="username" value=""/>
		<property name="password" value=""/>
		<property name="defaultAutoCommit" value="true"/>
	</bean>
	<bean id="AccountPull" class="com.salesforce.dataloader.dao.database.SqlConfig" singleton="true">
		<property name="sqlString">
			<value>select MyName from TestTable</value>
		</property>
		<property name="columnNames">
			<list>
        		<value>MyName</value>				
			</list>
		</property>
	</bean>
</beans>

 

And I got the error message as :

 

2011-09-26 21:25:09,734 ERROR [AccessPullProcess] database.DatabaseReader setupQuery (DatabaseReader.java:146) - Database error encountered during setup of the database configuration: queryAcc.  Sql error: Invalid Fetch Size.
java.sql.SQLException: Invalid Fetch Size
    at sun.jdbc.odbc.JdbcOdbcStatement.setFetchSize(JdbcOdbcStatement.java:826)
    at org.apache.commons.dbcp.DelegatingStatement.setFetchSize(DelegatingStatement.java:276)
    at com.salesforce.dataloader.dao.database.DatabaseReader.setupQuery(DatabaseReader.java:140)
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:109)
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:97)
    at com.salesforce.dataloader.util.DAORowUtil.calculateTotalRows(DAORowUtil.java:59)
    at com.salesforce.dataloader.dao.database.DatabaseReader.getTotalRows(DatabaseReader.java:209)
    at com.salesforce.dataloader.action.AbstractLoadAction.<init>(AbstractLoadAction.java:82)
    at com.salesforce.dataloader.action.BasePartnerLoadAction.<init>(BasePartnerLoadAction.java:44)
    at com.salesforce.dataloader.action.InsertAction.<init>(InsertAction.java:44)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at com.salesforce.dataloader.action.OperationInfo.instantiateAction(OperationInfo.java:66)
    at com.salesforce.dataloader.controller.Controller.executeAction(Controller.java:104)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:124)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:75)
    at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:227)
2011-09-26 21:25:09,750 ERROR [AccessPullProcess] util.DAORowUtil calculateTotalRows (DAORowUtil.java:72) - Error Calculating Total Rows
com.salesforce.dataloader.exception.DataAccessObjectInitializationException: Database error encountered during setup of the database configuration: queryAcc.  Sql error: Invalid Fetch Size.
    at com.salesforce.dataloader.dao.database.DatabaseReader.setupQuery(DatabaseReader.java:148)
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:109)
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:97)
    at com.salesforce.dataloader.util.DAORowUtil.calculateTotalRows(DAORowUtil.java:59)
    at com.salesforce.dataloader.dao.database.DatabaseReader.getTotalRows(DatabaseReader.java:209)
    at com.salesforce.dataloader.action.AbstractLoadAction.<init>(AbstractLoadAction.java:82)
    at com.salesforce.dataloader.action.BasePartnerLoadAction.<init>(BasePartnerLoadAction.java:44)
    at com.salesforce.dataloader.action.InsertAction.<init>(InsertAction.java:44)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at com.salesforce.dataloader.action.OperationInfo.instantiateAction(OperationInfo.java:66)
    at com.salesforce.dataloader.controller.Controller.executeAction(Controller.java:104)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:124)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:75)
    at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:227)
Caused by: java.sql.SQLException: Invalid Fetch Size
    at sun.jdbc.odbc.JdbcOdbcStatement.setFetchSize(JdbcOdbcStatement.java:826)
    at org.apache.commons.dbcp.DelegatingStatement.setFetchSize(DelegatingStatement.java:276)
    at com.salesforce.dataloader.dao.database.DatabaseReader.setupQuery(DatabaseReader.java:140)
    ... 16 more

 

Any pointers on how to fix this ? Does anybody have a working configuration file for MS Access data extraction ?

 

Regards,

 

Jerun Jose

Hi,

 

When I use the apex:DataTable tag in my VF, it is showing some junk data.

 

The codes that I am using are:

 

VF page:

<apex:page controller="testController" showHeader="false" sidebar="false" renderAs="pdf">
<h2> test text </h2>
<apex:form >
<apex:pageBlock>
<apex:pageBlockTable value="{!AccountList}" var="Account" border="1" width="700">
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Controller class:

public class testController{

public list<Account> AccountList{get;set;}

public testController(){
AccountList = [select id,Name from Account limit 5];
}
}

 

This gives the output as

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

 

test text

JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember

2010201120122013201420152016

MonTueWedThuFriSatSun

Today

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

 

The junk data does not appear when I render the page normally.

 

Any pointers on why this is happening and how to avoid it ?

I have a controller variable of time datatype.
public Time startTime{get;set;}

startTime = Time.newInstance(12,0,0,0);
Rendering the variable as is on visualforce will output as 12:00:00.000Z

I want to display this on a visualforce page in a proper time format using the outputText parameter passing technique.
I tried 
 
<apex:outputText value="{0, time, h:mm a}">
     <apex:param value="{!slot.startTime}" /> 
</apex:outputText>
I'm getting a compile time error "The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.". Anybody knows the correct syntax to get this working.

I know we can convert this variable as a datetime variable and use that instead, but wondering why Time variable does not work.

 
Hi, I have a created a check box field named "Is Credited". I want to write a validation rule "Is Credited is not true" so I used NOT(Is_Credited__c) but it seems to be wrong. Can anyone help me with the right syntax?
I have a requirement to display records from 2 objects (Account & Contact) in a single pageblocktable in a VF page, Account records followed by Contact records.
I know that we can achieve this using a wrapper class, but all the examples I came across talked about displaying checkbox or displaying columns vertically(not horizontally) from different objects in a pageblocktable.

Would appriciate any pointers/code samples. Thanks!!

User-added image

 
My requirement is to create a approval process.
Object 1 has field :quantity  .
   If quantity is greater than certain number it needs to go for approval.
   Once approved  it should autopopulate the approved date field and  the name of the person who approved it in object 2. 
object 1 and object 2 have lookup relationship

Heres what I did .
 1. I went to approvals and created a approval criteria for quantity and did the Email Alert for Initial submission actions in approval process.
 2. I created a workflow rule for update on Object2
   
    workflow action1 : Field to update : Date of approval
                               Formula value : Today()
    
    workflow action2: Field to Update    : Approved by 
                              Formula value      : $User.Username

3.I go back to approval process-> approval steps->approval actions->Add existing..
I cant find field updates that i need to create because i created them in object 2 as object 1 and object have lookup relationship

How can I solve this problem. Any help is appreciated.
 
I need to reorder the columns in pageblocktable on VFP. How can I do that.

Thanks,
Vijay
I receieved the following Error number when doing an upload for a change set.  I am attempting to upload email templates built in Production, and bring to Sandbox.  I receive an error message that says to contact Customer Support, but when I open a case, I get another error message, "Developer support for standard customers and partners is supported directly through our community.  If you have a developer support question, please click here."  

Yet, when I attempt to click on any of the case fields, its blocked out, and I am unable to submit the form.  Does anyone know what the Error Number is?  A google search did not help.  

Error Number: 1013122098-267274 (-476769046)
Please try to upload your change set again. If it does not succeed, contact Customer Support and provide the error number listed above.

 
I have a custom object (Properties__c) that is a related list item for Accounts. Since some of the properties have been sold, users only want to see the Active Properties in the related list for Acccounts. I have attempted to use the Account Standard Controller in Visualforce along with an extension to accomplish this:
My Visualforce page markup is as follows:
<apex:page sidebar="false" showHeader="false" StandardController="Account" extensions="ActProp">
  <apex:pageBlock title="List of Properties">
 <apex:pageBlockTable value="{!props}" var="a">
        <apex:column value="{!a.Name}"/>
        <apex:column value="{!a.Asset_Type__c}"/>
        <apex:column value="{!a.RecordType.Name}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
 </apex:page> 


My Controller extension is as follows:
public class ActProp{
   public ActProp(ApexPages.StandardController cont) {}
   List<Property__c> props = [Select Name, RecordType.Name, Asset_Type__c from Property__c where Status__c ='1'];
      public List<Property__c> getprops(){
      return props;
      } 
}


My Visualforce page an custom controller both save with no issues; however, when I run the Page with a valid account (one with properties), the only thing that is returned is the "List of Properties" Block Title. I have read through the VF documentation and viewed related YouTube videos to try to figure this out. I know that I am thisclose, but am missing an element. Any assistance would be greatly appreciated. Thank you.
I have a visualforce page, related to the Opportunity Object.
There is a  lookup field (Influencer1__c), which looksup to the Contact object, name. How can i create another field to show the contacts title?
<td valign="top" width="120"  bgcolor="#DCE1E9"><apex:outputField value="{!StrategicSales__c.Influencer1__c}" > 
  <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" 
    hideOnEdit="editButton" event="ondblclick" 
    changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
      </apex:outputField></td>
Thanks!
 
I have below controller:
public class MyController {
public string cString { get; set;}

public string getStringMethod1(){
return cString;
}

public string getStringMethod2(){
if(cString == null)
cString = 'Method2';
return cString;
}
}
VF:
<apex:page controller="MyController">
{!cString}, {!StringMethod1}, {!StringMethod2}, {!cString}
</apex:page>
Actual Output:
, , Method2,

But I am expecting output : , , Method2,Method2

Why so? Why is cString value not retained though it is being set in getStringMethod2 method?



 
Hi ,
I need  help in ordering the List. I have a List where the Field Priority__C must be ordered as Primary,Secondary, Tertiary,Fourth,Fifth,Sixth etc.. This order is in another List if Strings. 
The user can change the priority of the record, and after resequencing the priority the order must be same again as Primary, Secondary etc...
I tried ORDER BY Id. But when the priority is changed the Id remains same and so not able to get the ordering.
Please help.

I  have simple Sobject in my bd, with 2 number fields: index1__c, index2__c:

on my visualforce page i'm going to create record of this object only when these filelds are equal.

if they aren't I want to render another field of this objcet which says why they aren't equal

Creating the record must be obtained by pressing enter key. 

On pressing enter nothing happens.

Is any restrictons where  <apex:actionSupport> tag must be placed in? 

VF page 

<apex:page id="HM6" controller="HM6Controller">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:inputField value="{!hm.index1__c}"/>
                <apex:inputField value="{!hm.index2__c}"/>
               
             
            </apex:pageBlockSection>
            
        </apex:pageBlock>
        
        <apex:outputpanel id="block">
        
         <apex:outputField value="{!hm.reason_not_equals__c}" rendered="{!NOT(check)}" />
          <apex:actionSupport event="onkeypress" action="{!save}" reRender="block" />
          
        </apex:outputpanel>/>
        <apex:pageMessages />
    </apex:form>
</apex:page>
 

controller

/**
 * Created by LanaPC on 22.06.2016.
 */

public with sharing class HM6Controller {
    public HM6__c hm;

    public HM6__c getHM(){
        return hm;

    }
    public boolean check;

    private String fillMessalge(Decimal index1, Decimal index2){
        if(index1>index2) {
            return 'index1>index2';
        }else return 'inde1<index2';
    }

    public HM6Controller(){
        hm=new HM6__C();

    }

    public Boolean getcheck(){
        if (hm.index1__c==hm.index2__c){
        check = true;
        return check;
        }
        else {
           hm.reason_not_equals__c= fillMessalge(hm.index1__c,hm.index2__c);
            check= false;
            return  check;
        }
    }

    public PageReference save(){
        if (getcheck()) insert hm;
        return null;
    }


}
Hi,
I want to render a particular field in VF page when checkbox field on detail page will be checked. How i should do it? please help

Regards,
Amita Tatar



 
Hi All,

I need to access the individual value of a multiselect picklist field in my flow and compare each value to a text field in another object.
 While doing so, all the values of multiselect picklist are coming in the format "HR;Sales;Finance" but I have to access them individually.
Can any one help me out in this. 

Thanks In Advance!

Hi,

i have created a field called "Name" and now i need to add a not null validation to that field.

if i created a custom button called "save", if i click save button before inserting data to the Name field i need to get a validation message.

can anyone help me on this?

I have Client and Candidate Objects seprately. Created a Job Obejct with lookup to Client. I need to create 
1. Application Obejct as Junction with many o many for Job & Candidate 
2.I need to track interview as well, its a one-one mapping for Job, Candidate or can be lined to Application Object.
  Should I create another Junction object for Inerview (Job & Candidate)?
    Interview is for a particular Application Object so can I have Interview object looking up for existing Application (Juncion Object) 
3. If interview is success , I need another Onboarding object . Its for Client Object and Interview /Candidate . Do I need another object or merge with Interview/Assignemnt based on result field.

What is best approch for data modelling. Are there any examples and guidlines I cna look for ?
I need to find a way to keep certain users from creating new opportunities, thereby only being able to create them by converting a lead.  We have a sales process that starts with lead creation, and it completely throws off our metrics when an opportunity is created directly rather than through lead conversion.  That being said, one team SHOULD be able to do create directly (even if it's only from the 'clone' button).  SF support said I need custom code for this and I've no clue where to start.  Any help would be appreciated.
I have a controller variable of time datatype.
public Time startTime{get;set;}

startTime = Time.newInstance(12,0,0,0);
Rendering the variable as is on visualforce will output as 12:00:00.000Z

I want to display this on a visualforce page in a proper time format using the outputText parameter passing technique.
I tried 
 
<apex:outputText value="{0, time, h:mm a}">
     <apex:param value="{!slot.startTime}" /> 
</apex:outputText>
I'm getting a compile time error "The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.". Anybody knows the correct syntax to get this working.

I know we can convert this variable as a datetime variable and use that instead, but wondering why Time variable does not work.

 
We plan on having a 3rd party vendor doing some production deployments for us.  However, we don't want to provide username/password to our production enviroment at this time.

We're thinking we could have them use Force.com Migration Tool and provide an access token (oauth).  I'm assuming we would create a connected app/access token for this?  If so wouldn't the access token expire fairly quickly which would mean we would have to constantly create access tokens.  Or is there another access token I would create for this so it doesn't expire?

Or is there another option instead of using access token or another approach?  Bascially, we would like this team deploy to prodcution (visualforce pages, apex classess, etc.) but don't want to provide them username/password at this time.

Thanks

Posting this in order to help others who, months from now, might Google "OP_WITH_INVALID_USER_TYPE_EXCEPTION" and find this explanation.

 

We wrote an Apex trigger on the User object, to insert a custom object record anytime a user updates their Chatter status.  This was done to fulfill a client's requirement to audit all Chatter activity.

 

The trigger worked fine, until one day the client signed up some Chatter Free users.  When such a user tried to update their status, they got a pop-up with an OP_WITH_INVALID_USER_TYPE_EXCEPTION error.

 

We scratched our collective heads for awhile.  After all, Apex triggers run in "system mode," right?  That is supposed to mean that "object and field-level permissions of the current user are ignored."  And yet this trigger seemed like it was running in "user mode," enforcing restrictions based on who the current user was.

 

The root cause turned out to be that a Chatter Free user cannot be the owner of a custom object record, and SFDC by default sets the current user as a new record's first owner.  We discovered this when we realized, via experiment, that Apex triggers fired as the result of actions by Chatter Free users could definitely update an existing record, but were having problems creating records.

 

So the simple solution was to explicitly set the owner of the new record to some fully-licensed user prior to inserting it.