• amitashtekar
  • NEWBIE
  • 119 Points
  • Member since 2010

  • Chatter
    Feed
  • 2
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 41
    Replies

Hi,

 

I have two picklist fields.

 

I am able to apply style for controlling field but the style is not getting applied to dependent picklist.

 

Does anyone know how to apply style to dependent picklist.

 

Even I put javascript for onchange event of controlling picklist field to apply style for dependent picklist.

But it is not working.

 

It will be great help if some one have any idea to do it.

 

Thanks!

Hi,

 

Could anyone guide me how can I expose apex webservice to public. Which will not require any authentication.

 

Any help will be highly appreciated.

 

Thank you.

 

Regards,

Amit Ashtekar

whether force.com one app license includes offline feature

Hi All,

 

 

I want to show controlled picklist values based on selection of controller picklist within apex.

 

I have not provided any CRUD rights on the specific object to the profile.

 

Does any one have any idea about it.

 

 

Thank you.

 

 

Regards,

Amit

Hi All,

I am facing this issue.

Anyone have any idea how to solve this.

public void SaveChanges()
{
List<Account> AccountList = [Select Id, Name,(Select Id From Contacts) From Account where Id=:this.AccountId];


if(AccountList.size() > 0)
{
Account UpdateAccount = AccountList[0];
UpdateAccount.Name = this.Name;
UpdateAccount.AccountNumber = this.AccountNumber;
update UpdateAccount;

if(AccountList[0].Contacts.size() > 0)
{
Contact UserContact = AccountList[0].Contacts[0];
UserContact.FirstName = this.FirstName;
UserContact.LastName = this.LastName;
UserContact.Email = this.PersonalEmailId;
update UserContact;
}
else
{
Contact UserContact = new CanGeneral__c(AccountId = AccountList[0].Id,FirstName = this.FirstName,
LastName = this.LastName, Email = this.PersonalEmailId);
insert UserContact;
}
}
}

Hi,

 

I want to keep values entered within apex:inputSecret field if the action failed.

 

I am not making the variable as transient , still the value disappear if action fails.

 

So is there any work around for it.

 

Thank you.

I am creating a parent record and attaching images to it.

 

On the same page I am showing the parent record with the number of images attached to it.

 

When I set page size of standard set controller as 5 then for first record it shows me count of attachments as 4 even though it is more than that.

 

But when I set page size as 10, it shows me count 9.

 

This problem exists only when I have single record of parent object and disappears when I create one more record.

 

So does anyone know how the setpagesize() method of standard set controller works  for the child records.

 

Please help asap.

 

Thank you.

I am facing a javascript error that it is showing getAttributeNode() method deprecated while developing page.

 

Does anyone have any idea how to solve this issue?

 

Hi All,

 

I have created a list of a custom object.

One field from the custom object is storing attachment id.

I am saving images within attachments and attachment id is saved to with respective record of custom object.

 

While displaying list of records i want to show the image just aside to record information.

 

I have used the URLFOR function to fetch url of each image attachment

 

but at runtime it is showing me error as

Invalid parameter for function URLFOR

Error is in expression '{!URLFOR($Action.Attachment.Download ,su.AttachmentId)}' in component <apex:page> in page CustomPage
the code for the page is as like
<apex:pageBlockTable value="{!Records}" var="su">
                        <apex:column >
                            <table width="100%" border="0" cellspacing="0" cellpadding="10"
                                style="border-bottom: 1px solid #b7dffe;">
                                <tr>
                                    <td width="130" rowspan="3" align="center">
                                        <apex:image url="{!URLFOR($Action.Attachment.Download, su.AttachmentId)}"
                                                width="60" height="60" id="Image" title="{!su.Info} " />                                        
                                    </td>
                                    </tr></table></apex:column></apex:pageblocktable>
if anyone knows answer for this please help me out.
its very urgent

Hi All,

I am facing problem while sending an email alert through a workflow.

 

I have two object bound with master-detail relationship.

On certain operation of child object record, I want to send email to an email field of the parent object record.

 

Does anyone knows how to do it using workflow?

 

Hi,

 

I have created a email template and added site's custom web address as {!Site.TopLevelDomain}.

 

This email template is used to send email alert through a workflow.

 

This workflow will get fired as a result of some custom action(field update) through website.

 

I am receiving the email but without the custom web address of the website.

 

I have tried with some other fields like {!Site.UrlPathPrefix}, {!Site.Subdomain}

but it doesn't display any thing within email template as a result of these fields.

 

For the time being i have hard coded this url within the email template. But I want to remove this hard coded url.

 

Is there any thing else which need to be provided?

If any one have any idea please tell me.

 

 

Hi all,

I want to retrieve file names within a zipped static resource file via apex.

can anybody help me.

I am stuck with this.

Hi,

Could anyone telll me whether I can use a component multiple times in a single page or not?

I am stuck with an assignment because of it.

 

 

Thanks in advance.

Amit

I am facing a problem with windows 7 machine.

 

i have created a visual force page and added some command buttons on it which process some server side code.

and display the result on the same page.

 

when i log in to site and stay on that page for  about 5 mins and click a command button on the page it takes too much time for completing the request. Some times it is so long that it doesnot complete it.

 

I have checked with two browsers i.e. and mozilla.

This problem is specifically with windows 7 machine.

Could anyone guide me on this issue.

 

Hi,

i am facing the problem on windows 7 platform machines.

The site performance slows down on windows 7 platform.

Does anyone know why is it so?

hello,

I am not able to get return type as DateTime in formula field.

I have selected the field type as DateTime.

But after processing date time i am not able to convert it to DateTime from Date.

I want to add number of years in a date time field.

If I use like below

StartDate__c + Years

It just add number of days to it.

If I use like below

StartDate__c + 365 * Years

It create lag of few days.

Does anyone have any idea of how to do it.

I want to show the picklist value for global variable User on a visual force page.

 

But it is showing me incorrect parameter.

 

I have written code within vf as

 

<apex:outputlabel value="{! TEXT($User.UserType) }"/>

 

Does anyone knows how to do it.

I have tried different things.

I dont want to write any apex code for it.

hello,

 

i have created a visual force page. I am saving record on the button click.

but i am not able to restrict the user from clicking command button multiple times.

 

I have tried with providing action support on onclick and oncomplete event of the command button to change its disabled property.

Still the use is able click command button multiple times.

It creates unwanted records.

 

If any one has the solution, please share it with me.

Hello,

I want to use StandardSetController for a custom object. The user is a customer portal user. The user profile doesnot have any CRUD rights for that object(security purpose). I have created a data class with fields same as Custom object.

I want to use the StandardSetController to view the records with pagination by using data class.

 

Does anyone knows how to do it.

 

 

 

I have developed a daily poll component for the force.com based site.

 

I have used customer portal to authenticate users.

I have added that component within the right hand template.

<apex:component allowDML="true" controller="cybVotePoll" id="Poll">

<apex:pageBlock title="Today's&nbsp;Poll" id="PollPageBlock" mode="edit">

<apex:panelgrid id="Graph" columns="1">

<apex:outputLabel value="{!PollQuestion}"style="font-size:12px;font-style:italic;color:#0000ff;font-weight:bold;" />

<apex:outputLabel value="{!Msg}" style="color:#ff0000;" id="msg" />

<apex:form >

<apex:selectRadio value="{!UserVote}" id="ResponsePanel" disabled="{!DisableOptions}">

 <apex:selectOptions value="{!ResponseOptions}" />

<apex:actionSupport event="onclick" action="{!SubmitVote}"rerender="ResponsePanel,msg,OutputResult" status="test" />

 </apex:selectRadio>

</apex:form>

<apex:actionStatus id="test" startText="submitting vote..." />

<apex:image width="200" height="150" url="{!ResponseUrl}"id="OutputResult" />

<apex:form >

<apex:commandLink action="{!showPastResults}"value="Past Results >>" />

</apex:form>

</apex:panelgrid>

</apex:pageBlock>

</apex:component>

  

Whenever the radio option is selected on the page, it shows error page with error as insufficient privilege.

I have removed all ther crud rights from the profile so that user could not get access to salesforce standard pages.

Please any one guide me on this issue.

Hi,

 

I have two picklist fields.

 

I am able to apply style for controlling field but the style is not getting applied to dependent picklist.

 

Does anyone know how to apply style to dependent picklist.

 

Even I put javascript for onchange event of controlling picklist field to apply style for dependent picklist.

But it is not working.

 

It will be great help if some one have any idea to do it.

 

Thanks!

Hi All,

I am facing this issue.

Anyone have any idea how to solve this.

public void SaveChanges()
{
List<Account> AccountList = [Select Id, Name,(Select Id From Contacts) From Account where Id=:this.AccountId];


if(AccountList.size() > 0)
{
Account UpdateAccount = AccountList[0];
UpdateAccount.Name = this.Name;
UpdateAccount.AccountNumber = this.AccountNumber;
update UpdateAccount;

if(AccountList[0].Contacts.size() > 0)
{
Contact UserContact = AccountList[0].Contacts[0];
UserContact.FirstName = this.FirstName;
UserContact.LastName = this.LastName;
UserContact.Email = this.PersonalEmailId;
update UserContact;
}
else
{
Contact UserContact = new CanGeneral__c(AccountId = AccountList[0].Id,FirstName = this.FirstName,
LastName = this.LastName, Email = this.PersonalEmailId);
insert UserContact;
}
}
}

Hi,

 

I have two picklist fields.

 

I am able to apply style for controlling field but the style is not getting applied to dependent picklist.

 

Does anyone know how to apply style to dependent picklist.

 

Even I put javascript for onchange event of controlling picklist field to apply style for dependent picklist.

But it is not working.

 

It will be great help if some one have any idea to do it.

 

Thanks!

I modified an existing trigger on assets to also update the account team if a custom field on the asset has a value of 1. The trigger works as expected when I test it in the Sandbox however, it fails with too many SOQL queries when I execute the Test Class. The line it's failing on isn't inside of a for loop and should only be returning one record.  Can someone please explain what I've done wrong?

 

The trigger is failing on this line:

        // get the assignment group id for the VersaDoc Project Managers group   
        list<Assignment_Group_Name__c> asgnGroupNameIDs = [SELECT Id FROM Assignment_Group_Name__c WHERE Name = 'Support - VersaDoc Project Managers' limit 1];

Here's my trigger:

trigger trgAsset on Asset (after insert, after update, after delete) {
	if (trigger.isInsert || trigger.isUpdate){
		/*Trigger will update the Client_Since__c field on the account with the first purchase date for all assets.
		  If the Asset has VersaDoc and the account doesn't have a VersaDoc Project Account Team Member, 
		  it will assign the next VersaDoc Project manager from the assignment groups to the Account Team.*/
		// create a set of all the unique accountIds
		Set<id> accountIds= new Set<id>();
		Set<id> accountTeamAccountIds = new Set<id>(); // set of accountIDs that have VersaDoc in the asset
	    for (Asset a : Trigger.new){
	    	accountIds.add(a.AccountId); 
	    	if (a.HasVersadoc__c == 1 || a.HasVersadocStudio__c == 1 ) {
        		accountTeamAccountIds.add(a.AccountId); 
       	 	} 	
	    }
		   
		// create map of accountids and minimum purchase date
		map<ID, Date> acctSinceDate = new map<ID, Date>();	
	    AggregateResult[] groupedResults = [Select AccountId, MIN(PurchaseDate) MinPurchaseDate From Asset where AccountID in :accountIds GROUP BY AccountId];
		for (AggregateResult ar : groupedResults)  {
		    acctSinceDate.put(String.valueof(ar.get('AccountId')), Date.valueof(ar.get('MinPurchaseDate')) );
		}   	
		// create a map of accounts to update
		map<String, Account> accts = new map<String, Account>([Select Id, Client_Since__c from Account Where Id in :acctSinceDate.keySet()]);
		// update Account ClientSince field with MinimumPurchaseDate value
		//iterate over the list of accounts and assign the ClientSince date
		for (Account acct : accts.values()){
			acct.Client_Since__c = acctSinceDate.get(acct.Id);
		} 
		 if (accts.size()>0)
	        update(accts.values());
	        
		// get the assignment group id for the VersaDoc Project Managers group   
		list<Assignment_Group_Name__c> asgnGroupNameIDs = [SELECT Id FROM Assignment_Group_Name__c WHERE Name = 'Support - VersaDoc Project Managers' limit 1];
		
		Assignment_Groups__c[] asgnGroups = new List<Assignment_Groups__c>([SELECT Group_Name__c, User__c, Last_Assignment__c, Millisecond__c 
	                                   FROM Assignment_Groups__c 
	                                   WHERE Group_Name__c in :asgnGroupNameIds
	                                   AND Active__c = 'True' AND User_Active__c = 'True'
	                                   ORDER BY Last_Assignment__c, Millisecond__c] );                                    		
		Integer groupCount = asgnGroups.size();		
	    if (asgnGroups.isEmpty()) return;      

		//loop through list of accounts and get the accounts w/o VersaDoc Project Manager
		AccountTeamMember[] NewMembers = new AccountTeamMember[]{};  //list of new team members to add
	    AccountShare[] newShare = new AccountShare[]{};  //list of new shares to add
		Map<id, Account> acctsToUpdate = new Map<id, Account>([Select a.Id, (Select Id, AccountId From AccountTeamMembers WHERE TeamMemberRole = 'VersaDoc Project Manager' limit 1) From Account a Where a.Id in :accountTeamAccountIds]);
		Integer cnt = 0;
	    for (Account a : acctsToUpdate.values()){
	    	if (a.AccountTeamMembers == null || a.AccountTeamMembers.isEmpty()) {
	    		AccountTeamMember TeamMemberAd=new AccountTeamMember();
		        TeamMemberAd.AccountId=a.id;
		        TeamMemberAd.UserId=asgnGroups[cnt].User__c;
		       	TeamMemberAd.TeamMemberRole = 'VersaDoc Project Manager';
		        NewMembers.add(TeamMemberAd);	
		        datetime now = datetime.now();
		        asgnGroups.get(cnt).Last_Assignment__c=now;
		        asgnGroups.get(cnt).Millisecond__c = now.millisecondGMT(); 
	    		cnt ++;
	    		if (cnt == groupCount){ cnt = 0;}    	
	    	}
	    } 

		//insert any valid members then add their share entry if they were successfully added
	    Database.SaveResult[] lsr = Database.insert(NewMembers,false);
		Integer newcnt=0;
	    for(Database.SaveResult sr:lsr){
			if(!sr.isSuccess()){
				Database.Error emsg = sr.getErrors()[0];
				system.debug('\n\nERROR ADDING TEAM MEMBER:'+emsg);
			}else{
				newShare.add(new AccountShare(UserOrGroupId=NewMembers[newcnt].UserId, AccountId=NewMembers[newcnt].Accountid, AccountAccessLevel='Edit',OpportunityAccessLevel='Edit'));
			}
				newcnt++;			
	    }
	    //insert the new shares
	    Database.SaveResult[] lsr0 =Database.insert(newShare,false); 
	    Integer newcnt0=0;
	    for(Database.SaveResult sr0:lsr0){
			if(!sr0.isSuccess()){
				Database.Error emsg0=sr0.getErrors()[0];
			    system.debug('\n\nERROR ADDING SHARING:'+newShare[newcnt0]+'::'+emsg0);
			}
				newcnt0++;
	    } 
	    // update assignment groups with their LastAssignmentDate
	    update asgnGroups; 	                   	                     
	} else if (trigger.isDelete){
		// create a set of all the unique accountIds
		Set<id> accountIds = new Set<id>();
	    for (Asset a : Trigger.old)
	    	accountIds.add(a.AccountId); 	
		   
		// create map of accountids and minimum purchase date
		map<ID, Date> acctSinceDate = new map<ID, Date>();
		
	    AggregateResult[] groupedResults = [Select AccountId, MIN(PurchaseDate) MinPurchaseDate From Asset where AccountID in :accountIds GROUP BY AccountId];
		for (AggregateResult ar : groupedResults)  {
		    acctSinceDate.put(String.valueof(ar.get('AccountId')), Date.valueof(ar.get('MinPurchaseDate')) );
		} 
		// create a map of accounts to update 
		map<string, Account> accts = new map <string, Account>([Select Id, Client_Since__c from Account Where Id in :accountIds]);
		for (Account acct : accts.values()){
			// if there's a value in the acctSinceDate map, update the Client_Since__c date to that date, otherwise set to null.
			if(acctSinceDate.ContainsKey(acct.Id)){
				acct.Client_Since__c = acctSinceDate.get(acct.Id); 
			}else {
				acct.Client_Since__c = null;
			} 
		}
		update(accts.values());
	}
}

 Here's my test class:

 

@isTest
private class testTrgAsset {
	static testMethod void myUnitTest() {
		// create user to run the test as
	    Profile p = [select Id from profile where name = 'Standard User'];
	    UserRole r = [select Id from userrole where name = 'Sales Assistant'];
	       
	    User u = new User(lastname='testing', alias='test123', email='testing123@noemail.com',
	    	username='testing123@noemail.com', profileid = p.Id, userroleid = r.id,
	       	emailencodingkey='utf-8', Office_Code__c='US0000', LanguageLocaleKey='en_US',
	       	localesidkey='en_US', timezonesidkey='America/Los_Angeles');
	    insert u;	
	    
	    System.runAs(u) {  
		   	// Switch to the runtime 
		   	Test.StartTest(); 
		   		performCreateAssignmentGroups(u.Id, p.Id, r.id);
		       	performCreateAccounts(u.Id);   		   		
				performCreateAssets(u.Id);  
				performCreateAdditionalAssets(u.Id);
				performUpdateOriginalPurchaseDate(u.Id);
				performDeleteAssets(u.Id);
				performCreateVersaDocAssets(u.Id);	
		  	Test.StopTest();   
	     }
	}
	
	public static void performCreateAssignmentGroups(string createdby, string profileid, string userrole){
		integer i=0;
		List<User> users = new list<User>();
		for (i=0; i<3; i++){
			User u = new User(
			lastname = 'testing'+i,
			alias='test'+i,
			email='testing'+i+'@noemail.com',
			username='testing'+i+'@noemail.com',
			emailencodingkey='utf-8',
			Office_Code__c = 'US000',
			profileid = profileid,
			userroleid = userrole,
			LanguageLocaleKey='en_US',
			localesidkey='en_US', 
			timezonesidkey='America/Los_Angeles',
			IsActive=true);
			users.add(u);
		}
		insert users;
		
		//create an assignment group name
		Assignment_Group_Name__c agn = new Assignment_Group_Name__c(Name = 'Support - VersaDoc Project Managers');
		insert agn;
		
		Assignment_Groups__c[] NewMembers = new Assignment_Groups__c[]{};  //list of new assignmentgroup members to add
			
		for (User u : users){
			datetime now = datetime.now(); 
			Assignment_Groups__c a = new Assignment_Groups__c(
				Group_Name__c=agn.Id,
				User__c = u.Id,
				Active__c = 'true',
				Last_Assignment__c= now);
			NewMembers.add(a);
		}
		insert NewMembers;			
	}
	
	public static void performCreateAccounts(string createdby){
		list<Account> accts = new list<Account>();	
		User u = [select Id from User where Id =: createdby];
		integer i = 0;
	    // create 200 accounts
	    for (i=0; i < 200; i++ ){
	    	Account acc = new Account(
	    		Name='Testing Account ' +i, 
	    		Industry='Printers', 
	    		Type = 'Client',
	    		CreatedBy = u);
	    	accts.add(acc);
	    }	
	    insert accts;
	}

	public static void performCreateAssets(string createdby){
		list<Asset> assts = new list<Asset>();
		list<Account> accts = new list<Account>([Select id from Account where CreatedById =: createdby]);
		Product2 prod = [select Id from Product2 where Name = 'PrinterPresence Silver Level'];
		date now = date.today();
	   
	    // create an asset for each account
		for (Account acct : accts ){
			Asset a = new Asset(
	   			Product2 = prod,
	   			Name = 'PrinterPresence Silver Level',
	   			AccountID = acct.Id,
	   			Status = 'Purchased',
	   			PurchaseDate = now,
	   			RMR__c = 160.00, 
	   			Price = 2000.00);
	   		assts.add(a);	 
		}
	    insert assts;
	    
	      //check results of accounts to be sure ClientSince date was updated to the PurchaseDate
		 list <Account> accs = [Select Id, Client_Since__c from Account Where CreatedById =: createdby];
		 for (Account a : accs){
		 	System.assertEquals(now, a.Client_Since__c);   
		 }  
	}
	
	public static void performCreateAdditionalAssets(string createdby){
		list<Asset> assts = new list<Asset>();
		list<Account> accts = new list<Account>([Select id from Account where CreatedById =: createdby]);		
	 	list <Asset> insertedAsst = [Select Id from Asset where CreatedbyId =: createdby];		
		Product2 prod = [select Id from Product2 where Name = 'PrinterPresence Gold Level'];
		date now = date.today();
		
		//update previous asset to Attritioned-Upgrade
		for (Asset ass : insertedAsst){
			ass.Status = 'Attritioned-Upgrade';
			ass.UsageEndDate = System.today();
		}		
		update insertedAsst;
			   
	    // create an asset for each account
		for (Account acct : accts ){
			Asset a = new Asset(
	   			Product2 = prod,
	   			Name = 'PrinterPresence Gold Level',
	   			AccountID = acct.Id,
	   			Status = 'Purchased-Upgrade',
	   			PurchaseDate = now,
	   			RMR__c = 210.00, 
	   			Price = 500.00);
	   		assts.add(a);	 
		}
	    insert assts;
	    
	      //check results of accounts to be sure ClientSince date was updated to the PurchaseDate
		 list <Account> accs = [Select Id, Client_Since__c from Account Where CreatedById =: createdby];
		 for (Account a : accs){
		 	System.assertEquals(now, a.Client_Since__c);   
		 }  
	}
	
	public static void performUpdateOriginalPurchaseDate(string createdby){
		date now = date.today();
		// get a list of the original assets	
	 	list <Asset> insertedAsst = [Select Id from Asset where CreatedbyId =: createdby and Status = 'Attritioned-Upgrade'];
	 			
		//update original asset purchase date
		for (Asset ass : insertedAsst){
			ass.PurchaseDate = now;
		}		
		update insertedAsst;
			   
	     //check results of accounts to be sure ClientSince date was updated to the new PurchaseDate
		 list <Account> accs = [Select Id, Client_Since__c from Account Where CreatedById =: createdby];
		 for (Account a : accs){
		 	System.assertEquals(now, a.Client_Since__c);   
		 }  
	}
	
	public static void performDeleteAssets(string createdby){
		list<Account> accts = new list<Account>();	
		User u = [select Id from User where Id =: createdby];
		integer i = 0;
	    // create 100 accounts
	    for (i=0; i < 100; i++ ){
	    	Account acc = new Account(
	    		Name='Testing Account ' +i, 
	    		Industry='Nonprofit', 
	    		Type = 'Client',
	    		CreatedBy = u);
	    	accts.add(acc);
	    }	
	    insert accts;
	    
	    // insert one asset for each of the new accounts
	    list<Asset> assts = new list<Asset>();
		list<Account> insertedAccts = new list<Account>([Select id from Account where CreatedById =: createdby and Industry='Nonprofit']);
		Product2 prod = [select Id from Product2 where Name = 'Nonprofit Silver Level'];
	   	Product2 prod2 = [select Id from Product2 where Name = 'PrinterPresence Silver Level'];
	   
	    // create an asset for each account
		for (Account acct : accts ){
			Asset a = new Asset(
	   			Product2 = prod,
	   			Name = 'Nonprofit Silver Level',
	   			AccountID = acct.Id,
	   			Status = 'Purchased',
	   			PurchaseDate = date.newinstance(2012, 01, 01),
	   			RMR__c = 110.00, 
	   			Price = 3000.00);
	   		assts.add(a);	 
		}
	    insert assts;
	    
	    // delete assets for all accounts
	    list <Asset> AssetToDelete = [Select Id from Asset where CreatedbyId =: createdby and (Name = 'Nonprofit Silver Level' or name = 'PrinterPresence Silver Level')];
	    
		delete AssetToDelete;
		
		//check results of accounts to be sure ClientSince date was updated to empty for the newly created accounts
		 list <Account> accs = [Select Id, Client_Since__c from Account Where CreatedById =: createdby and Industry='Nonprofit'];
		 for (Account a : accs){
		 	System.assertEquals(Null, a.Client_Since__c);   
		 } 
		//check results of accounts to be sure ClientSince date was updated to the new PurchaseDate
		 list <Account> accs1 = [Select Id, Client_Since__c from Account Where CreatedById =: createdby and Industry='Printers'];
		 for (Account a1 : accs1){
		 	System.assertEquals(System.today(), a1.Client_Since__c);   
		 }  
	}
	
	public static void performCreateVersaDocAssets(string createdby){
	    // add PrinterPresence Platinum level Asset (Has VersaDoc)
	    date now = date.today(); 
	    list<Account> accts = new list<Account>([Select id from Account where CreatedById =: createdby]);	
	    Product2 product = [Select p.Name, p.Id From Product2 p where p.name = 'PrinterPresence Platinum Level'];
	    list<Asset> assets = new list<Asset>();
	   
	    for(Account a : accts){
	    	Asset ass = new Asset(
	    		Name=product.Name,
	    		Product2Id=product.Id,
	    		Status='Purchased',
	    		Price=7500.00,
	    		RMR__c=310.00,
	    		AccountId=a.Id,
	    		PurchaseDate=now);
	    	assets.add(ass);
	    }
	    insert assets;
	    
	    //check results of inserted accounts to be sure a VersaDoc Project Manager was assigned	
		list <Account> accs = [Select Id, AccountNumber from Account Where CreatedById =: createdby and Type = 'Client' and Name like 'Testing Account%'];
		
		Map<id, Account> acctTeams = new map<id, Account>([Select a.Id, (Select Id, AccountId From AccountTeamMembers WHERE TeamMemberRole = 'VersaDoc Project Manager' limit 1) From Account a Where a.Id in :accts]);
		for (Account a : acctTeams.values()){
			System.assertNotEquals(a.AccountTeamMembers, Null);
		}  
	}
}

 Thanks!

Hi ,

how to convert the UTF-8 String To Unicode  in Salesforce 

Can u please send  an Example to use in the Apex class

 

 

 

thanks in advance

 

  • March 20, 2013
  • Like
  • 0

1) How many customer portal License in Enterprise and unlimited edition?

For developer 5.

 

2) I would like to know how much a customer portal license costs?
I've wondered how much they pay for their portal every month?


3) If I buy a sfdc in enterprise edition. shall I buy a both enterprise editon and user license?

 

4) in my company , more than 1000 user will customer portal custom license. what is the total cost of whole system?

I want to build a web store and use force.com to build its stock & invoice management.

 

But how about user accounts? Shall I hold them on my website or somehow create accounts in my Org on force.com?

 

Thanks!

  • March 20, 2013
  • Like
  • 0

Hi Everyone,

 

Seeking your kind help !

 

I have a situation here. In Accounts I have two types of accounts available (Active & Inactive). Now, for a specific profile,is it possible to make the inactive accounts not visible when searched? I have used a Advanced searched filter, when Active=True only then the active accounts are visible.

 

Thanks All !            

My req ::

is that i have a checkbox(NSURANCE TAKEN FOR LOAN),and when the
checkbox is checked then two fields should be enabled or else it
should be disabled

 

The two fields which are to be enabled are:

Insurance_Premium_Paid__c &  Insurance_Renewal_Date__c

CODE::


<apex:actionRegion >
                    <apex:inputField
value="{!Family__c.Insurance_taken_for_Loan__c}" id="insFlag">
                        <apex:actionSupport event="onchange"
rerender="insPremPaid,insRenDateOutput,insRenDateInput"
status="processingStatus"/>
                    </apex:inputField>
                </apex:actionRegion>
                </apex:pageBlockSectionItem>
                <apex:inputText
value="{!Family__c.Insurance_Premium_Paid__c}" id="insPremPaid"
disabled="{!NOT(Family__c.Insurance_taken_for_Loan__c)}"/>
                <apex:outputField
value="{!Family__c.Insurance_Renewal_Date__c}" id="insRenDateOutput"
rendered="{!NOT(Family__c.Insurance_taken_for_Loan__c)}"/>
                <apex:inputField
value="{!Family__c.Insurance_Renewal_Date__c}" id="insRenDateInput"
rendered="{IF(!Family__c.Insurance_taken_for_Loan__c==TRUE,TRUE,FALSE)}"/>

Here the insurance renewal date is a date field.

My problem is i am NOT getting the Insurance renewal date field enabled
vhn m checking the checkbox.

  • March 20, 2013
  • Like
  • 0

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 All,

I am facing this issue.

Anyone have any idea how to solve this.

public void SaveChanges()
{
List<Account> AccountList = [Select Id, Name,(Select Id From Contacts) From Account where Id=:this.AccountId];


if(AccountList.size() > 0)
{
Account UpdateAccount = AccountList[0];
UpdateAccount.Name = this.Name;
UpdateAccount.AccountNumber = this.AccountNumber;
update UpdateAccount;

if(AccountList[0].Contacts.size() > 0)
{
Contact UserContact = AccountList[0].Contacts[0];
UserContact.FirstName = this.FirstName;
UserContact.LastName = this.LastName;
UserContact.Email = this.PersonalEmailId;
update UserContact;
}
else
{
Contact UserContact = new CanGeneral__c(AccountId = AccountList[0].Id,FirstName = this.FirstName,
LastName = this.LastName, Email = this.PersonalEmailId);
insert UserContact;
}
}
}

HI all,

 

Q) What is the difference between Database.insert and Insert?

 

can you please give me rply its very urgent

 

thanks for your help....

Hi,

 

I have created a email template and added site's custom web address as {!Site.TopLevelDomain}.

 

This email template is used to send email alert through a workflow.

 

This workflow will get fired as a result of some custom action(field update) through website.

 

I am receiving the email but without the custom web address of the website.

 

I have tried with some other fields like {!Site.UrlPathPrefix}, {!Site.Subdomain}

but it doesn't display any thing within email template as a result of these fields.

 

For the time being i have hard coded this url within the email template. But I want to remove this hard coded url.

 

Is there any thing else which need to be provided?

If any one have any idea please tell me.

 

 

hi,

 

I have query like select count() some condition and it returns more than 10000 records.

 

As per the governor limits we cannot fetch more than 10000 records using query .What is the alternative to get rid of this limit.