-
ChatterFeed
-
7Best Answers
-
0Likes Received
-
0Likes Given
-
1Questions
-
49Replies
Using Property file in Salesforce
Hello,
There are hard voded text on my visualforce page.
like
I want to put all text in visualforce page, that can be modified.
How can i do it in salesfforce
There are hard voded text on my visualforce page.
like
<apex:outputText value="Validity" />I want to put "Validity" in a property file and use the property file.
I want to put all text in visualforce page, that can be modified.
How can i do it in salesfforce
- Simrin
- June 04, 2015
- Like
- 0
- Continue reading or reply
Strange behaviour with boolean value of dynamic query string
Hi all, hoping someone can help.
I won't bore you with the ins and out of the code, but basically, I have a query string I am dynamically populating from an SObject and seeing if it is true.
The code snippet is below:
It is returning me these two debugs and I have no idea why!
qforcesupport@quintessentially.com == qforcesupport@quintessentially.com
false
So it is stating that the two values are not the same....
Please someone help!
I won't bore you with the ins and out of the code, but basically, I have a query string I am dynamically populating from an SObject and seeing if it is true.
The code snippet is below:
private static Boolean shouldShowInInbox(String queryString, SObject sObjectToCheck, Set<String> fieldsToCheck){ for(String fieldToCheck : fieldsToCheck){ String fieldValueOnObject = String.valueOf(sObjectToCheck.get(fieldToCheck)); queryString = queryString.replaceAll(fieldToCheck, String.isBlank(String.valueOf(fieldValueOnObject)) ? '' : String.valueOf(fieldValueOnObject)); } System.debug(queryString); System.debug(Boolean.valueOf(queryString)); return Boolean.valueOf(Boolean.valueOf(queryString)); }
It is returning me these two debugs and I have no idea why!
qforcesupport@quintessentially.com == qforcesupport@quintessentially.com
false
So it is stating that the two values are not the same....
Please someone help!
- David Holland 6
- May 29, 2015
- Like
- 0
- Continue reading or reply
Export Report Data with HTTP Request
Hi everyone,
I need to export a report data with one scheduled job and apex code. When I've the csv data I need to send a HTTP Request.
The problem is the report data size is 30Mb aprox...
How do you do it? What is it the better way?
Thanks!
I need to export a report data with one scheduled job and apex code. When I've the csv data I need to send a HTTP Request.
The problem is the report data size is 30Mb aprox...
How do you do it? What is it the better way?
Thanks!
- Juan Pedro Catalan 2
- May 28, 2015
- Like
- 0
- Continue reading or reply
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Assigned To ID: owner cannot be blank: [OwnerId
Hi All,
I am trying to get owner id of parent object. but i am not able to get it.
I did like this .
[select id,ParentObject__r.OwnerId from Childobject__c];
can any one tell me how to resolve it..
Thanks in advance.
I am trying to get owner id of parent object. but i am not able to get it.
I did like this .
[select id,ParentObject__r.OwnerId from Childobject__c];
can any one tell me how to resolve it..
Thanks in advance.
- salesforce@14
- May 28, 2015
- Like
- 0
- Continue reading or reply
System.NullPointerException: Attempt to de-reference a null object Error
The line attempting to create the Set "ids" is throwing an error upon insert of a new lead.
Here is the error "System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, leadTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object".
How do you get the Id for trigger.new?
Here is the error "System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, leadTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object".
How do you get the Id for trigger.new?
trigger leadTrigger on Lead (before insert, after insert, after update) { Set<ID> ids = Trigger.newMap.keySet(); // getting error here List<Lead> triggerLeads = [SELECT Id, Email, LeadSource FROM Lead WHERE Id in :ids]; }
- jjvdev
- May 26, 2015
- Like
- 0
- Continue reading or reply
Trigger code coverage for test class
Hi all,
I am written one trigger and test class.. Test class code covered 73% i need to increase more.
Trigger:-
trigger UpdatePropertybyGroup on Property__c (after insert, after update) {
Set<Object> Properties = new set<Object>();
Map< String, Set<Object> > PropertiesPerAccount = new Map< String, Set<Object> >();
Map< String, Object> AllProperties = new Map<String, Object>();
Set< String> AllIdsOfproperties = new Set<String>();
List<Property__c> NeedToUpdateGroupProperties = new List<Property__c>();
Property__c p1 = Trigger.new[0];
if( p1.Account__c == '001f000000l10C5' ) {
for(Property__c p : Trigger.new){
AllProperties.put( p.Account__c , p);
AllIdsOfproperties.add(p.Id);
}
set<String>AccountIds = AllProperties.keySet();
for( String account: AccountIds ){
Properties.clear();
for( String propAccount :AllProperties.keySet() ) {
if( AllProperties.containsKey( account ) )
Properties.add( AllProperties.get( account ) );
}
PropertiesPerAccount.put( account , Properties);
}
List<Property__c> SFDCproperties = [Select Id,name,Account__c,Group_Membership__c from Property__c where Id In :AllIdsOfproperties];
List<Grouping__c> SFDCGroups = [Select Id,name,Account__c from Grouping__c where Account__c IN : AccountIds];
Map<String, String> NewGroupPerAccount = new Map<String, String>();
set<String> UniqueGroupName = new set<String>();
List<Grouping__c> groups = new List<Grouping__c>();
for(Property__c p :SFDCproperties) {
if( null == p.Group_Membership__c ) {
if( ! SFDCGroups.isEmpty() ) {
Boolean IsGroupExists = false;
for( Grouping__c grp : SFDCGroups ) {
if( grp.Name == p.Name ) {
IsGroupExists = true;
p.Group_Membership__c = grp.Id;
NeedToUpdateGroupProperties.add(p);
break;
} else {
IsGroupExists = false;
}
}
if( false == IsGroupExists ) {
if(!UniqueGroupName.contains(p.Name)){
Grouping__c g = new Grouping__c();
g.Name = p.Name;
g.Account__c = p.Account__c;
groups.add(g);
UniqueGroupName.add(p.Name);
}
}
} else {
if(!UniqueGroupName.contains(p.Name)){
Grouping__c g = new Grouping__c();
g.Name = p.Name;
g.Account__c = p.Account__c;
groups.add(g);
UniqueGroupName.add(p.Name);
}
}
}
}
if( !groups.isEmpty() )
upsert groups;
for(Property__c p :SFDCproperties){
for(Grouping__c grp : groups){
if(grp.Name == p.Name){
p.Group_Membership__c = grp.Id;
NeedToUpdateGroupProperties.add(p);
}
}
}
if( !NeedToUpdateGroupProperties.isEmpty() )
update NeedToUpdateGroupProperties;
}
}
Test class:-
@isTest
public class TestUpdatePropertybyGroup {
@isTest static void updateproperty() {
Account a = new Account(Name ='Test');
insert a;
Property__c p = new Property__c(Name ='Testing', Active__c = 'ýes', Price__c =1,Square_Footage__c = 1,Bed_Count__c =1, Bath_Count__c =1, Pet_Policy__c ='No',Lease_Terms__c = 1,Address_Line_1__c = 'Test', City__c ='Test', State__c='Test', Zip_Code__c ='1',Concurrent_Showings_Allowed__c= 'no', Default_Appointment_Length__c ='no', Default_Buffer_Before_Appointments__c ='no');
insert p;
Grouping__c g = new Grouping__c(Name = 'Testing');
insert g;
}
}
Thanks in adv.
I am written one trigger and test class.. Test class code covered 73% i need to increase more.
Trigger:-
trigger UpdatePropertybyGroup on Property__c (after insert, after update) {
Set<Object> Properties = new set<Object>();
Map< String, Set<Object> > PropertiesPerAccount = new Map< String, Set<Object> >();
Map< String, Object> AllProperties = new Map<String, Object>();
Set< String> AllIdsOfproperties = new Set<String>();
List<Property__c> NeedToUpdateGroupProperties = new List<Property__c>();
Property__c p1 = Trigger.new[0];
if( p1.Account__c == '001f000000l10C5' ) {
for(Property__c p : Trigger.new){
AllProperties.put( p.Account__c , p);
AllIdsOfproperties.add(p.Id);
}
set<String>AccountIds = AllProperties.keySet();
for( String account: AccountIds ){
Properties.clear();
for( String propAccount :AllProperties.keySet() ) {
if( AllProperties.containsKey( account ) )
Properties.add( AllProperties.get( account ) );
}
PropertiesPerAccount.put( account , Properties);
}
List<Property__c> SFDCproperties = [Select Id,name,Account__c,Group_Membership__c from Property__c where Id In :AllIdsOfproperties];
List<Grouping__c> SFDCGroups = [Select Id,name,Account__c from Grouping__c where Account__c IN : AccountIds];
Map<String, String> NewGroupPerAccount = new Map<String, String>();
set<String> UniqueGroupName = new set<String>();
List<Grouping__c> groups = new List<Grouping__c>();
for(Property__c p :SFDCproperties) {
if( null == p.Group_Membership__c ) {
if( ! SFDCGroups.isEmpty() ) {
Boolean IsGroupExists = false;
for( Grouping__c grp : SFDCGroups ) {
if( grp.Name == p.Name ) {
IsGroupExists = true;
p.Group_Membership__c = grp.Id;
NeedToUpdateGroupProperties.add(p);
break;
} else {
IsGroupExists = false;
}
}
if( false == IsGroupExists ) {
if(!UniqueGroupName.contains(p.Name)){
Grouping__c g = new Grouping__c();
g.Name = p.Name;
g.Account__c = p.Account__c;
groups.add(g);
UniqueGroupName.add(p.Name);
}
}
} else {
if(!UniqueGroupName.contains(p.Name)){
Grouping__c g = new Grouping__c();
g.Name = p.Name;
g.Account__c = p.Account__c;
groups.add(g);
UniqueGroupName.add(p.Name);
}
}
}
}
if( !groups.isEmpty() )
upsert groups;
for(Property__c p :SFDCproperties){
for(Grouping__c grp : groups){
if(grp.Name == p.Name){
p.Group_Membership__c = grp.Id;
NeedToUpdateGroupProperties.add(p);
}
}
}
if( !NeedToUpdateGroupProperties.isEmpty() )
update NeedToUpdateGroupProperties;
}
}
Test class:-
@isTest
public class TestUpdatePropertybyGroup {
@isTest static void updateproperty() {
Account a = new Account(Name ='Test');
insert a;
Property__c p = new Property__c(Name ='Testing', Active__c = 'ýes', Price__c =1,Square_Footage__c = 1,Bed_Count__c =1, Bath_Count__c =1, Pet_Policy__c ='No',Lease_Terms__c = 1,Address_Line_1__c = 'Test', City__c ='Test', State__c='Test', Zip_Code__c ='1',Concurrent_Showings_Allowed__c= 'no', Default_Appointment_Length__c ='no', Default_Buffer_Before_Appointments__c ='no');
insert p;
Grouping__c g = new Grouping__c(Name = 'Testing');
insert g;
}
}
Thanks in adv.
- kumar.fdc81.3902978579608325E12
- May 26, 2015
- Like
- 0
- Continue reading or reply
Partner Soap Error Using PHP
Hi,
I am using Partner SOAP API using PHP code. I am getting this error message while authentication
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://salesforce.com/soap/wsdl.jsp' : Extra content at the end of the document
I am trying to run this API through my localsystem. Is it any permission issue which is restricting me to access information in salesforce?
Does anyone has an idea about this issue. Any help would be appriciated.
Thanks!!
I am using Partner SOAP API using PHP code. I am getting this error message while authentication
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://salesforce.com/soap/wsdl.jsp' : Extra content at the end of the document
I am trying to run this API through my localsystem. Is it any permission issue which is restricting me to access information in salesforce?
Does anyone has an idea about this issue. Any help would be appriciated.
Thanks!!
- Jayant Jadhav
- September 07, 2015
- Like
- 0
- Continue reading or reply
How do i send a XML to Tally Server?
Hello Guys,
I have a XML request i need to HIT tally Server, How do I achieve this?
<ENVELOPE>
<HEADER>
<TALLYREQUEST>Export Data</TALLYREQUEST>
</HEADER>
<BODY>
<EXPORTDATA>
<REQUESTDESC>
<REPORTNAME>List of Accounts</REPORTNAME>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<ACCOUNTTYPE>All Inventory Masters</ACCOUNTTYPE>
</STATICVARIABLES>
</REQUESTDESC>
</EXPORTDATA>
</BODY>
</ENVELOPE>
The Request is also I get in XML?
Please guide me on how to achieve this functionality.
Thanks in Advance.
- Kishore B T 21
- November 21, 2015
- Like
- 0
- Continue reading or reply
Using Property file in Salesforce
Hello,
There are hard voded text on my visualforce page.
like
I want to put all text in visualforce page, that can be modified.
How can i do it in salesfforce
There are hard voded text on my visualforce page.
like
<apex:outputText value="Validity" />I want to put "Validity" in a property file and use the property file.
I want to put all text in visualforce page, that can be modified.
How can i do it in salesfforce
- Simrin
- June 04, 2015
- Like
- 0
- Continue reading or reply
Problem with Test Code
My test code is only covering 36% of my Apex trigger and I'm stuck on how to get it up...Can someone please point me in the right direction?
TRIGGER:
trigger TempFieldsToCampaignAndEvent on Contact (after insert) {
List<CampaignMember> membersToAdd = new List<CampaignMember>();
List<Event> NewEvents = new List<Event>();
for (Contact c: Trigger.new) {
if(c.TempCampaign__c != null) {
CampaignMember cm = new CampaignMember(CampaignId=c.TempCampaign__c, ContactId=c.Id, Status=c.TempCampaignStatus__c);
membersToAdd.add(cm);
}
system.debug(c.TempEventDescription__c);
if(c.TempEventDescription__c != null){
Event e = new Event();
e.StartDateTime = c.TempEventTime__c;
e.ActivityDateTime = c.TempEventTime__c;
e.Subject = c.TempEventSubject__c;
e.WhatId = c.TempCampaign__c;
e.Description = c.TempEventDescription__c;
e.WhoId = c.Id;
e.OwnerId = '0051a000000hmuN';
e.DurationInMinutes = 0;
NewEvents.add(e);
}
}
database.insert (membersToAdd, false);
insert NewEvents;
}
TEST CLASS
@IsTest
public class AAAllTest {
public testMethod static void contactInsertion() {
// Consider setting some address fields as required by copyAddressFields
Contact c = new Contact(lastname='testing', firstname='apex');
insert c;
//Make some assertions based on the results of the copyAddressFields call
}
public testMethod static void contactInsertionFails() {
// Set some fields that will cause an Exception in copyAddressFields
Contact c = new Contact(lastname='testing', firstname='apex');
insert c;
//Make some assertions that errors were added to the Contact
}
public testMethod static void bulkifedInsertion() {
Contact[] contactsToCreate = new Contact[]{};
for(Integer x=0; x<200;x++){
Contact ct = new Contact(lastname='testing',firstname='apex');
contactsToCreate.add(ct);
}
Test.startTest();
insert contactsToCreate;
Test.stopTest();
}
public testMethod static void CampaignInsertion() {
// Consider setting some address fields as required by copyAddressFields
Campaign m = new Campaign(Name='Test Campaign');
insert m;
//Make some assertions based on the results of the copyAddressFields call
}
public testMethod static void EventInsertion() {
// Consider setting some address fields as required by copyAddressFields
date ctd = Date.today(); // will set the todays date
Event e = new Event(Subject='Test', StartDateTime=ctd, EndDateTime=ctd, WhoId='0031700000AU6P9', DurationInMinutes=0);
insert e;
}
public testMethod static void CampaignMembers() {
// Consider setting some address fields as required by copyAddressFields
date ctd = Date.today(); // will set the todays date
CampaignMember cm = new CampaignMember(CampaignId='70117000001ARcU', ContactId='0031700000AU6P4', Status='Responded');
database.insert (cm, false);
//Make some assertions based on the results of the copyAddressFields call
}
}
TRIGGER:
trigger TempFieldsToCampaignAndEvent on Contact (after insert) {
List<CampaignMember> membersToAdd = new List<CampaignMember>();
List<Event> NewEvents = new List<Event>();
for (Contact c: Trigger.new) {
if(c.TempCampaign__c != null) {
CampaignMember cm = new CampaignMember(CampaignId=c.TempCampaign__c, ContactId=c.Id, Status=c.TempCampaignStatus__c);
membersToAdd.add(cm);
}
system.debug(c.TempEventDescription__c);
if(c.TempEventDescription__c != null){
Event e = new Event();
e.StartDateTime = c.TempEventTime__c;
e.ActivityDateTime = c.TempEventTime__c;
e.Subject = c.TempEventSubject__c;
e.WhatId = c.TempCampaign__c;
e.Description = c.TempEventDescription__c;
e.WhoId = c.Id;
e.OwnerId = '0051a000000hmuN';
e.DurationInMinutes = 0;
NewEvents.add(e);
}
}
database.insert (membersToAdd, false);
insert NewEvents;
}
TEST CLASS
@IsTest
public class AAAllTest {
public testMethod static void contactInsertion() {
// Consider setting some address fields as required by copyAddressFields
Contact c = new Contact(lastname='testing', firstname='apex');
insert c;
//Make some assertions based on the results of the copyAddressFields call
}
public testMethod static void contactInsertionFails() {
// Set some fields that will cause an Exception in copyAddressFields
Contact c = new Contact(lastname='testing', firstname='apex');
insert c;
//Make some assertions that errors were added to the Contact
}
public testMethod static void bulkifedInsertion() {
Contact[] contactsToCreate = new Contact[]{};
for(Integer x=0; x<200;x++){
Contact ct = new Contact(lastname='testing',firstname='apex');
contactsToCreate.add(ct);
}
Test.startTest();
insert contactsToCreate;
Test.stopTest();
}
public testMethod static void CampaignInsertion() {
// Consider setting some address fields as required by copyAddressFields
Campaign m = new Campaign(Name='Test Campaign');
insert m;
//Make some assertions based on the results of the copyAddressFields call
}
public testMethod static void EventInsertion() {
// Consider setting some address fields as required by copyAddressFields
date ctd = Date.today(); // will set the todays date
Event e = new Event(Subject='Test', StartDateTime=ctd, EndDateTime=ctd, WhoId='0031700000AU6P9', DurationInMinutes=0);
insert e;
}
public testMethod static void CampaignMembers() {
// Consider setting some address fields as required by copyAddressFields
date ctd = Date.today(); // will set the todays date
CampaignMember cm = new CampaignMember(CampaignId='70117000001ARcU', ContactId='0031700000AU6P4', Status='Responded');
database.insert (cm, false);
//Make some assertions based on the results of the copyAddressFields call
}
}
- Jonathan Sheehan
- May 31, 2015
- Like
- 0
- Continue reading or reply
How to integrate: retrieve data from a MSSQL server db on premise and update my salesforce app?
Hi,
I have never done an integration before. Building my first interface to a business application running on-premise with a MS SQL Server database. This app contains data that I need to bring into my salesforce app.
I am looking to build an interface/integration such that data is retrieved on a schedule from the MS SQL db and have it updated onto my Salesforce app.
Can someone point me to a go-to place where I can figure this out?
Thanks,
BillBay
I have never done an integration before. Building my first interface to a business application running on-premise with a MS SQL Server database. This app contains data that I need to bring into my salesforce app.
I am looking to build an interface/integration such that data is retrieved on a schedule from the MS SQL db and have it updated onto my Salesforce app.
Can someone point me to a go-to place where I can figure this out?
Thanks,
BillBay
- Billbay
- May 29, 2015
- Like
- 0
- Continue reading or reply
Generating Autoresponse from Template when Lead is Created
Hello guys
I have code that automatically generates leads from my email. Now what I need is something that can inform the sender that their query is being processed. Now I have created a tigger to send the response but it doesnt seem to work. Is there something I am missing?
I have code that automatically generates leads from my email. Now what I need is something that can inform the sender that their query is being processed. Now I have created a tigger to send the response but it doesnt seem to work. Is there something I am missing?
trigger EmailToLeadResponseTrigger on Lead (after insert) { final String template = 'SalesLeadCreatedWebInquiries'; Id templateId; try { templateId = [SELECT id FROM EmailTemplate WHERE Name = :template].id; } catch (QueryException e) { //...handle exception if no template is retrieved, or create condition to set email body in code } List<Messaging.SingleEmailMessage> messages = new List<Messaging.SingleEmailMessage>(); //Send a single mail to contact each created lead for (Lead l : [SELECT Name, Lead.Email FROM Lead WHERE Id in :Trigger.new]) { Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage(); message.setTemplateId(templateId); message.setTargetObjectId(l.Id); message.setWhatId(l.Id); message.setToAddresses(new String[] {l.Email}); messages.add(message); } }
- Mark Lewis 21
- May 29, 2015
- Like
- 1
- Continue reading or reply
Strange behaviour with boolean value of dynamic query string
Hi all, hoping someone can help.
I won't bore you with the ins and out of the code, but basically, I have a query string I am dynamically populating from an SObject and seeing if it is true.
The code snippet is below:
It is returning me these two debugs and I have no idea why!
qforcesupport@quintessentially.com == qforcesupport@quintessentially.com
false
So it is stating that the two values are not the same....
Please someone help!
I won't bore you with the ins and out of the code, but basically, I have a query string I am dynamically populating from an SObject and seeing if it is true.
The code snippet is below:
private static Boolean shouldShowInInbox(String queryString, SObject sObjectToCheck, Set<String> fieldsToCheck){ for(String fieldToCheck : fieldsToCheck){ String fieldValueOnObject = String.valueOf(sObjectToCheck.get(fieldToCheck)); queryString = queryString.replaceAll(fieldToCheck, String.isBlank(String.valueOf(fieldValueOnObject)) ? '' : String.valueOf(fieldValueOnObject)); } System.debug(queryString); System.debug(Boolean.valueOf(queryString)); return Boolean.valueOf(Boolean.valueOf(queryString)); }
It is returning me these two debugs and I have no idea why!
qforcesupport@quintessentially.com == qforcesupport@quintessentially.com
false
So it is stating that the two values are not the same....
Please someone help!
- David Holland 6
- May 29, 2015
- Like
- 0
- Continue reading or reply
Export Report Data with HTTP Request
Hi everyone,
I need to export a report data with one scheduled job and apex code. When I've the csv data I need to send a HTTP Request.
The problem is the report data size is 30Mb aprox...
How do you do it? What is it the better way?
Thanks!
I need to export a report data with one scheduled job and apex code. When I've the csv data I need to send a HTTP Request.
The problem is the report data size is 30Mb aprox...
How do you do it? What is it the better way?
Thanks!
- Juan Pedro Catalan 2
- May 28, 2015
- Like
- 0
- Continue reading or reply