• dclaar
  • NEWBIE
  • 25 Points
  • Member since 2009

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

We need to automatically generate the serial number on the “new asset” screen (i.e. asset edit), based on several parameters, including date and a function written in javascript.

 

First thought: Add something to the “save” button to do this. Problems (all “near as I can tell, based on trying it, and then googling”):

1)     Can’t modify edit screen. So can’t add javascript.

2)     If extend class and override “save” button, SFDC finds the empty fields first, and I never get called.

 

Second thought: Add a button to generate data, insert data into DOM so that it is there for the save. Problems:

1)     Still can’t modify screen.

2)     Even if I could add button, if it uses Visualforce, it will fail due to Cross site scripting restrictions.

 

Third thought: Write a new page in Visualforce. There are several minor problems:

1)     How do I fill in the account text box? $Component doesn’t seem to work.

2)     How do I set the date to be 90 days in the future for the calendar pulldown?

3)     How do I get the default calendar date into its text box right at the start?

But the major problem with #3 is that I can’t get the data saved! I’ve tried:

1)     this.save – that was fun when my extension function was save: endless loop. When I renamed my function, it said “I see no save here”.

2)     super.save – oh, right, this isn’t java.

3)     Save controller (which is passed in to initializer) as private variable "co" in the initializer, call co.save() in my save function.

4)     Upsert co.getRecords() in my save function.

 

I suppose if I knew SF better, this would be easy, but so far, it just ain’t happenin’, and any help would be appreciated.

  • April 26, 2010
  • Like
  • 0

Anyone have any ideas on how to get the same results from apex and openssl?

 

Here's my apex code:

private blob encrypt() {
String algorithmName = 'RSA';
String key = 'MIc' +
'key' +
'mouse=';
Blob privateKey = EncodingUtil.base64Decode(key);
Blob input = Blob.valueOf('Donald Duck');
Blob signature = Crypto.sign(algorithmName, input, privateKey);
return signature;
}

I generated the key as follows:

openssl genrsa -out key.pem
openssl pkcs8 -topk8 -nocrypt -in key.pem -outform PEM

and copied the private key into the "MIckeymouse=" key in my apex code.

And here's what I'm trying to do in openssl:

fp = fopen("key.pem","rb");
rsa=PEM_read_RSAPrivateKey(fp,NULL, NULL, NULL);
license="Donald Duck";
l_len=strlen(license);
s_len=RSA_size(rsa);
signature=(char *)malloc(s_len);
nid=OBJ_txt2nid("rsa-sha1");
RSA_sign(nid,license,l_len,signature,&s_len,rsa);
printf("signature: len=%d, value=%s\n",s_len,base64(signature,s_len));

I can't get them to match. I've also tried plain "rsa" as my nid. This gave different results, but they still didn't match.

  • April 16, 2010
  • Like
  • 0

If you have a sandbox setup, www.salesforce.com gets changed to test.salesforce.com. By default, these modules can't handle that. The module's current maintainer showed me how to deal with that:

 

my $sforce = WWW::Salesforce->login( 'username' => 'foo', 'password' => 'bar', 'serverurl' => 'https://test.salesforce.com/services/Soap/u/8.0' ) or die $!;

 

 

 

my $sforce = WWW::Salesforce::Simple->new( 'username' => 'foo', 'password' => 'bar', 'serverurl' => 'https://test.salesforce.com/services/Soap/u/8.0' ) or die $!;

 

 

Pretty darn cool.

  • September 09, 2009
  • Like
  • 0

This is a really cool module! There's a tiny bug in version 0.10, however: The module doesn't check to see if $limit exists before trying the pattern match.

Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/WWW/Salesforce/Simple.pm line 35.

 

Here's a patch:

diff -c WWW/Salesforce/Simple.pm.orig WWW/Salesforce/Simple.pm *** WWW/Salesforce/Simple.pm.orig 2009-09-09 13:31:58.000000000 -0700 --- WWW/Salesforce/Simple.pm 2009-09-09 13:30:06.000000000 -0700 *************** *** 33,39 **** } $limit = 2000 ! unless $limit =~ m/^\d+$/ and $limit > 0 and $limit < 2001; my @rows = (); #to be returned --- 33,39 ---- } $limit = 2000 ! unless defined $limit && $limit =~ m/^\d+$/ and $limit > 0 and $limit < 2001; my @rows = (); #to be returned

 

  • September 09, 2009
  • Like
  • 0

We need to automatically generate the serial number on the “new asset” screen (i.e. asset edit), based on several parameters, including date and a function written in javascript.

 

First thought: Add something to the “save” button to do this. Problems (all “near as I can tell, based on trying it, and then googling”):

1)     Can’t modify edit screen. So can’t add javascript.

2)     If extend class and override “save” button, SFDC finds the empty fields first, and I never get called.

 

Second thought: Add a button to generate data, insert data into DOM so that it is there for the save. Problems:

1)     Still can’t modify screen.

2)     Even if I could add button, if it uses Visualforce, it will fail due to Cross site scripting restrictions.

 

Third thought: Write a new page in Visualforce. There are several minor problems:

1)     How do I fill in the account text box? $Component doesn’t seem to work.

2)     How do I set the date to be 90 days in the future for the calendar pulldown?

3)     How do I get the default calendar date into its text box right at the start?

But the major problem with #3 is that I can’t get the data saved! I’ve tried:

1)     this.save – that was fun when my extension function was save: endless loop. When I renamed my function, it said “I see no save here”.

2)     super.save – oh, right, this isn’t java.

3)     Save controller (which is passed in to initializer) as private variable "co" in the initializer, call co.save() in my save function.

4)     Upsert co.getRecords() in my save function.

 

I suppose if I knew SF better, this would be easy, but so far, it just ain’t happenin’, and any help would be appreciated.

  • April 26, 2010
  • Like
  • 0

Anyone have any ideas on how to get the same results from apex and openssl?

 

Here's my apex code:

private blob encrypt() {
String algorithmName = 'RSA';
String key = 'MIc' +
'key' +
'mouse=';
Blob privateKey = EncodingUtil.base64Decode(key);
Blob input = Blob.valueOf('Donald Duck');
Blob signature = Crypto.sign(algorithmName, input, privateKey);
return signature;
}

I generated the key as follows:

openssl genrsa -out key.pem
openssl pkcs8 -topk8 -nocrypt -in key.pem -outform PEM

and copied the private key into the "MIckeymouse=" key in my apex code.

And here's what I'm trying to do in openssl:

fp = fopen("key.pem","rb");
rsa=PEM_read_RSAPrivateKey(fp,NULL, NULL, NULL);
license="Donald Duck";
l_len=strlen(license);
s_len=RSA_size(rsa);
signature=(char *)malloc(s_len);
nid=OBJ_txt2nid("rsa-sha1");
RSA_sign(nid,license,l_len,signature,&s_len,rsa);
printf("signature: len=%d, value=%s\n",s_len,base64(signature,s_len));

I can't get them to match. I've also tried plain "rsa" as my nid. This gave different results, but they still didn't match.

  • April 16, 2010
  • Like
  • 0

I have created an apex trigger in my developer edition of salesforce, and now I need to deploy/package it and install it onto my company's professional edition.

 

First of all, I believe it is possible but not 100% sure. I've been searching around, and it seems like apex triggers can be packaged and installed on professional edition but need to pass a security test or something. Can anyone fill me in on this or point me to something that explains it?

 

Also, assuming it is possible I have a few questions. The trigger that I made works on a custom object as well as a built in object (case) with custom fields added. The custom object and fields already exist in my company's professional edition. How will that work? When I tried to use the deply option in eclipse with the force.com plugin, I noticed that it gave me the choice to remove the action to overwrite the custom objects, but when I created the (unmanaged) package it didn't give me any similar options. Will the package automatically detect if the dependencies already exist or will it overwrite the objects (I would like it to NOT overwrite)? I did not recreate the custom object exactly as it is in my company's instance, just the fields that are needed in the trigger.

 

Thanks for any help.

This is a really cool module! There's a tiny bug in version 0.10, however: The module doesn't check to see if $limit exists before trying the pattern match.

Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/WWW/Salesforce/Simple.pm line 35.

 

Here's a patch:

diff -c WWW/Salesforce/Simple.pm.orig WWW/Salesforce/Simple.pm *** WWW/Salesforce/Simple.pm.orig 2009-09-09 13:31:58.000000000 -0700 --- WWW/Salesforce/Simple.pm 2009-09-09 13:30:06.000000000 -0700 *************** *** 33,39 **** } $limit = 2000 ! unless $limit =~ m/^\d+$/ and $limit > 0 and $limit < 2001; my @rows = (); #to be returned --- 33,39 ---- } $limit = 2000 ! unless defined $limit && $limit =~ m/^\d+$/ and $limit > 0 and $limit < 2001; my @rows = (); #to be returned

 

  • September 09, 2009
  • Like
  • 0

Hi all-

 

Is there anyway to access the sandbox data with the SFDC Excel Connector? Any help is appreciated! 

 

BW

Hello,

 

I'm sure we're missing something blindingly obvious here. We have a trivial little perl script using WWW::Salesforce::Simple, to update a custom object.

 

We have a test case setup, as follows:

 

 

 

$WWW::Salesforce::Constants::TYPES{Data_Questionnaire__c}->{Custom_Number__c} = 'xsd:double'; $WWW::Salesforce::Constants::TYPES{Data_Questionnaire__c}->{Custom_Results__c} = 'xsd:string'; my %data = ( id => $id, Custom_Number__c => 5, Custom_Results__c => 'http://someurl.com' ); my $result = $sf->update(type => 'Data_Questionnaire__c', %data);

 

We receive the following error, despite ensuring the the type is of 'xsd::double', and the custom field 'Custom__Number__c' is of type Numeric:

Custom Number: value not of required type: 5

 


Has anyone experienced this issue before? Any information would be greatly appreciated.

 

  • February 18, 2009
  • Like
  • 0
I am using perl version 5.8.8 (ActiveState). Using ppm, I can not find WWW::Salesforce module (See below):


C:\Documents and Settings\xxx>ppm search Salesforce
*** no packages matching 'Salesforce' found ***


Thanks,
Behzad
  • August 04, 2008
  • Like
  • 0