• alaschgari
  • NEWBIE
  • 22 Points
  • Member since 2012

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

Hey folks,

I cannot access an XML file that I have uploaded as a public static resource. What am I doing wrong?

 

Thanks in advance

Josh :-)

 

P.S.: My requirement is to make an XML file available externally (without login needed) via SFDC. Any other suggestions are appreciated, too!

Hey folks,

 

I experience a OpportunityTeamMember data deletion, if I change the owner of the opportunity.

How can I prevent this? Even with a new owner I want to keep the opportunity team!

 

Thank you ver much

Josh :-)

Hey folks!

 

<apex:page standardcontroller="CustomObject__c" extensions="SF42_CustomObjectControllerExtension" showHeader="false" contenttype="application/vnd.ms-excel#{!c.Name}.xls" cache="true">

(...)

<img width="143" height="45" src="https://abcde.com/logo.png" />

(...)

 

 

I want to publish a VF page with an image.

The image has an external 'https' URL.

At the moment the image is not visible once the excel file is generated.

 

How can I make it visible?

 

Thank you very much

Josh :-)

Hey folks,

 

Salesforce 2 Salesforce: Since there's no reactivation of a stopped sharing of objects possible I want to make sure that the option "STOP Sharing" is not accessible by the user.

 

I thought about creating a PartnerNetworkRecordConnection BEFORE DELETE trigger that throws an error before deletion. But this is not possible, because the PartnerNetworkRecordConnection object is not available for triggers...

 

Is there any other way to still prevent deletion?

Or even better: is there a way of reactivating the old sharing reocrd?

 

Cheers

Josh :-)

Hey folks,

I want to mass accept these records automatically. How is that possible?

 

 

By the way: The auto-accept option does not work since the opportunity (child object) has more than 1 lookup field to account (parent object).

Hey folks!

I want to run a scheduled class right after a trigger has fired. This is my cron expression so far:

 

Datetime n = Datetime.now();
CRON_EXP = '0 ' + n.addMinutes(1).format('m') + ' ' + n.format('H') + ' ' + n.format('d') + ' ' + n.format('M') + ' ? '+ n.format('yyyy');

 

How do I modify this expression so that the code is only executed one time / once?

 

Thanks for your help

Josh :-)

Hey folks,

I want to implement a method that is able to update a couple of objects which all have the same lookupfields:

 

Object1.LookupField1

Object1.LookupField2

Object2.LookupField1

Object2.LookupField2

 

My idea looks something like this:

 

trigger Object1Trigger on Object1 (before insert)
{
   for(Object1 o1 : trigger.new)
   {
      o1 = updateLookups(o1);
   }
}

trigger Object2Trigger on Object2 (before insert)
{
   for(Object1 o2 : trigger.new)
   {
      o2 = updateLookups(o2);
   }
}


updateLookups(SObject obj)
{
   /* Logic to determine userId1 & userId2 */
//TODO

obj.put(LookupField1, userId1);
obj.put(LookupField2, userId2); return obj; }

 Is this a good solution and if

YES: how do I have to implement it?

NO: which solution is even better?

 

Cheers

Josh :-)

 

Hey folks,

 

What is the best solution to prevent this error message: 

System.LimitException: Attempted to schedule too many concurrent batch jobs in this org (limit is 5).

 

Cheers

Josh :-)

Hey folks,

 

My customer has an org where batches are started regularly throughout the day. In order to prevent getting the "5 batches limit" error, my primary solution would be to implement something like a batch queue. Is this a) the best solution and b) if yes, how can I implement it?

 

Cheers

Josh :-)

Hi folks!

 

I was asking myself the following question:

Who is the most trusted source in the community when it comes to code effectivity and efficiency?

 

I want to improve my code effectivity and efficiency. Who do I have to talk to or read from?

What is your personal opinion?

 

I'm looking forward to your answers!

Josh :-)

Hey folks,

I'm writing a testclass for my Salesforce to Salesforce class. Here's the code so far:

 

public with sharing class sf42_TestClass
{
	public static testmethod void testAccountForwarding()
	{
		Test.startTest();
		Account a = sf42_TestDataGenerator.createTestAccount(1, true);
		Contact c = sf42_TestDataGenerator.createTestContact(1, a.Id, true);
		PartnerNetworkRecordConnection pnrc = [SELECT Status, LocalRecordId FROM PartnerNetworkRecordConnection WHERE LocalRecordId = :a.Id LIMIT 1];
		System.assertEquals(a.Id, pnrc.LocalRecordId);
		System.assertEquals('Invite', pnrc.Status);
		Test.stopTest();
	}
}

 How am I able to change the status 'Invite' to 'Accepted'?

EDIT: Sorry, I want to change it form 'invite' to 'Sent'!

 

Cheers

Josh

Hey folks,

 

As I forward my opportunity from org A, it is not accetped automatically by org B, even if Auto-Accept is enabled. What's the problem?

 

Thanks!

Josh

Hey folks,

 

I'd like to create a trigger that automatically forwards new and updated opportunities AND related opportunity products (oppoprtunitylineitem) to my target org. How would a trigger like this look like?

 

Thanks!

Josh

Hey folks,

 

I've written an after insert, after update trigger that automates forwarding accounts and related contacts/opportunites to a partner org. The account itself is forwarded correctly, but the related contacts and opportunities don't get transferred...

 

Here's a debug log of the PartnerNetworkRecordConnection object:

 

10:21:35:359 USER_DEBUG [20]|ERROR|### objectConnections: (PartnerNetworkRecordConnection:{ConnectionId=04Pd0000000PXXXXX, SendEmails=true, SendOpenTasks=false, LocalRecordId=001d000000ViOQ3AAN, RelatedRecords=Contact,Opportunity, SendClosedTasks=false, ParentRecordId=null})

 

What's the problem?

Thank you for your support!

Hey folks!

Is it possible to connect two dev orgs via Salesforce to Salesforce? I get the following error so far: "Partner org is not active and no API calls are allowed"

Hey folks,

 

I already know that it is possible to export vf pages to excel. But I was wondering whether it is possible to export a visualforce page to excel in DIN A4 format so that I can print it directly without having to adjust cells.

At the moment my pageBlockTable does not fill the whole DIN A4 excel page.

 

Thanks

Josh

Hey folks,

how can I accomplish a testcoverage for the Database.Error class?

 

This is my code:

 

Database.Saveresult[] lsr = Database.update(lstSchedulingsToUpdate, false);

for(Database.SaveResult sr : lsr)
{
	if(!sr.isSuccess())
	{
	  	for(Database.Error err : sr.getErrors())
	  		errorMsgs += sr.getId() + ': ' + err.getMessage() + '(' + err.getStatusCode() + ')' + '\n';
	 }
}

 

Thanks in advance!

Josh

Hey folks,

I have a Visualforce Page where I can order items out of a table.

I choose the quantity by writing an Integer value in a column with <apex:inputText> fields.

Once I submit the page with a command button and an error pagemessage occurs, the <apex:inputText> fields that I didn't fill with an Integer value get a standard value 0 instead of staying empty. Why?

 

Dear folks,

See the difference:

 

Database.SaveResult[getErrors=();getId=a0dD0000006nlVsIAI;isSuccess=true;]

Database.SaveResult[getErrors=(Database.Error[getFields=();getMessage=Signature Type wrong;getStatusCode=FIELD_CUSTOM_VALIDATION_EXCEPTION;]);getId=null;isSuccess=false;]

 

Why am I not able to see the Id for the record that failed?

 

Thanks,

Josh

 

 

Hey SFDC champions!

I want to implement the following scenario:

 

1. Part: done

+ Opportunity has contract childs

+ Opportunity layout has an embedded VF Page with jQuery Tabs

+ Every tab represents 1 contract child object

 

2. Part: solution is needed

+ If opportunity has more than 0 contracts, then show VFPage in full size (height of iFrame = 750px)

+ If opportunity has 0 contracts, then show VFPage in small size (height of iFrame = 50px)

 

Do you guys have an idea on how to implement the second part?

 

Thank you very much

Josh :-)

Hey folks,

 

I experience a OpportunityTeamMember data deletion, if I change the owner of the opportunity.

How can I prevent this? Even with a new owner I want to keep the opportunity team!

 

Thank you ver much

Josh :-)

Hey folks,

I want to mass accept these records automatically. How is that possible?

 

 

By the way: The auto-accept option does not work since the opportunity (child object) has more than 1 lookup field to account (parent object).

Hey folks!

I want to run a scheduled class right after a trigger has fired. This is my cron expression so far:

 

Datetime n = Datetime.now();
CRON_EXP = '0 ' + n.addMinutes(1).format('m') + ' ' + n.format('H') + ' ' + n.format('d') + ' ' + n.format('M') + ' ? '+ n.format('yyyy');

 

How do I modify this expression so that the code is only executed one time / once?

 

Thanks for your help

Josh :-)

Hey folks,

I want to implement a method that is able to update a couple of objects which all have the same lookupfields:

 

Object1.LookupField1

Object1.LookupField2

Object2.LookupField1

Object2.LookupField2

 

My idea looks something like this:

 

trigger Object1Trigger on Object1 (before insert)
{
   for(Object1 o1 : trigger.new)
   {
      o1 = updateLookups(o1);
   }
}

trigger Object2Trigger on Object2 (before insert)
{
   for(Object1 o2 : trigger.new)
   {
      o2 = updateLookups(o2);
   }
}


updateLookups(SObject obj)
{
   /* Logic to determine userId1 & userId2 */
//TODO

obj.put(LookupField1, userId1);
obj.put(LookupField2, userId2); return obj; }

 Is this a good solution and if

YES: how do I have to implement it?

NO: which solution is even better?

 

Cheers

Josh :-)

 

Hi folks!

 

I was asking myself the following question:

Who is the most trusted source in the community when it comes to code effectivity and efficiency?

 

I want to improve my code effectivity and efficiency. Who do I have to talk to or read from?

What is your personal opinion?

 

I'm looking forward to your answers!

Josh :-)

Hey folks,

I'm writing a testclass for my Salesforce to Salesforce class. Here's the code so far:

 

public with sharing class sf42_TestClass
{
	public static testmethod void testAccountForwarding()
	{
		Test.startTest();
		Account a = sf42_TestDataGenerator.createTestAccount(1, true);
		Contact c = sf42_TestDataGenerator.createTestContact(1, a.Id, true);
		PartnerNetworkRecordConnection pnrc = [SELECT Status, LocalRecordId FROM PartnerNetworkRecordConnection WHERE LocalRecordId = :a.Id LIMIT 1];
		System.assertEquals(a.Id, pnrc.LocalRecordId);
		System.assertEquals('Invite', pnrc.Status);
		Test.stopTest();
	}
}

 How am I able to change the status 'Invite' to 'Accepted'?

EDIT: Sorry, I want to change it form 'invite' to 'Sent'!

 

Cheers

Josh

Hey folks,

 

As I forward my opportunity from org A, it is not accetped automatically by org B, even if Auto-Accept is enabled. What's the problem?

 

Thanks!

Josh

Hey folks,

 

I'd like to create a trigger that automatically forwards new and updated opportunities AND related opportunity products (oppoprtunitylineitem) to my target org. How would a trigger like this look like?

 

Thanks!

Josh

Hey folks,

 

I've written an after insert, after update trigger that automates forwarding accounts and related contacts/opportunites to a partner org. The account itself is forwarded correctly, but the related contacts and opportunities don't get transferred...

 

Here's a debug log of the PartnerNetworkRecordConnection object:

 

10:21:35:359 USER_DEBUG [20]|ERROR|### objectConnections: (PartnerNetworkRecordConnection:{ConnectionId=04Pd0000000PXXXXX, SendEmails=true, SendOpenTasks=false, LocalRecordId=001d000000ViOQ3AAN, RelatedRecords=Contact,Opportunity, SendClosedTasks=false, ParentRecordId=null})

 

What's the problem?

Thank you for your support!

Hey folks!

Is it possible to connect two dev orgs via Salesforce to Salesforce? I get the following error so far: "Partner org is not active and no API calls are allowed"

Hi,

 

I've successfully written a trigger to automatically share Account records with related opportunities to partners.  I've written a second trigger on Opportunities that does the same thing.  This is so that once an account is shared, new opportunities also get shared.

 

The problem is now Opportunity Line Items.   After much fooling around, I've finally got it all configured nicely so that I can share opportunities and opportunity line items manually through the Salesforce UI and the product lines land nicely in the partner system.  However I want to do this by trigger as well, so that not just the opportunity goes, but also the line items.  I feel that if it works manually, the trigger should work but it doesnt.

 

Here's the trigger.  Any ideas??

 

Thanks!!

 

 

trigger shareOpportunity on Opportunity (after insert, after update) {

List<PartnerNetworkConnection> connMap = new List<PartnerNetworkConnection>([select Id, 
    ConnectionStatus, ConnectionName from PartnerNetworkConnection where ConnectionStatus = 'Accepted']);

List<PartnerNetworkRecordConnection> pncList = new List<PartnerNetworkRecordConnection>();



    for (Opportunity o : Trigger.new) {
        if (o.Originating_System__c == 'CRR' ) {
            for (PartnerNetworkConnection pnc : connMap) {
                
             PartnerNetworkRecordConnection newOpprecord = new PartnerNetworkRecordConnection(
                
                        ConnectionId = pnc.Id,
                        LocalRecordId = o.Id,
                        SendClosedTasks = false,
                        SendOpenTasks = false,
                        SendEmails = false,
                        ParentRecordId = o.AccountId,
                        RelatedRecords = 'OpportunityLineItem'
                    );
                        
                pncList.add(newOpprecord);
                
            }   
        }
    }
    
    
    
    if (!pncList.isEmpty()) {
        upsert pncList;
    }

 

}

 

 

Hi all,

I was happily humming along writing my Case before insert trigger, but when I wrote my tests, they all failed.  This appears to be due to the fact that Trigger.newMap is coming up null, and I'm trying to use it late in my trigger.  Meanwhile, Trigger.new works just fine.

I added this code to the very beginning of my trigger:

trigger CaseAutocreateContact on Case (before insert) {
      System.debug(Trigger.newMap == null?'Trigger.newMap is null!':'Trigger.newMap is populated.');

And lo and behold when I run my tests I see:

    20081107011750.678:Trigger.CaseAutocreateContact: line 2, column 5: Trigger.newMap is null!

What gives here?  How can Trigger.new be populated but Trigger.newMap be null?  My trigger is using the 14.0 endpoint.

Thanks.