• caj
  • NEWBIE
  • 50 Points
  • Member since 2007

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
#!/usr/bin/perl
use WWW::Salesforce::Simple ;

my $sforce = WWW::Salesforce::Simple->new( username => 'user@domain.com',
                                           password => 'pas$w@rd!' );
print "Connection result: $sforce\n" ;

 I'm unable to get the basic code above to work.  When I run it, either on Linux or on Windows, I get the following message:

Incorrect parameter at /path/to/perl5/lib/perl5/SOAP/Lite.pm line 1993

I'm using EPIC to debug.  The failure is occuring at line 482 of Salesforce.pm:

 

 

    $self->{'sf_sid'}       = $r->valueof('//loginResponse/result/sessionId');

 My debugger shows that there is a value for //loginResponse/result/sessionId.  The valueof function is calling the match method which is calling the _traverse method.  _traverse is recursive, but line 1993 of Lite.pm prevents the recursion tree from gong more than 10 levels deep, which is where my code dies out.

 

I can't, however, quite follow the logic of the _traverse function. Is there a bug there?

 

Hi all,
 
I get a Javascript error (Invalid Argument) while using apex:commandLink. My code is as under:
 
Code:
<apex:pageBlock rendered="{!showFifthSection}">
    <table width="80%">
        <tr>
            <td style="font-weight:bold;" width="20%" valign="top">
                Enter Hi ROC adjustment criteria:
            </td>
            <td width="10%">
                <apex:inputField value="{!contractTerms.ADJ_RT_CRITERIA__c}" />
            </td>
            <td></td>
        </tr>
        <tr>
            <td colspan="3">
                <apex:pageMessage severity="info" strength="1" title="Please include details regarding the criteria for which the Hi-ROC rate reduction or increase would adjust.  Describe any rate adjustment tables, and include references to pages and sections within the contract that explain the rate adjustment criteria.  Include details, such as number of month's notice an account must have before a rate change." />
            </td>
        </tr>
        <tr>
            <td style="font-weight:bold;">Enter effective date(s) Hi-ROC adjustment(s):</td>
            <td><apex:inputField id="termDt" value="{!termDates.Date__c}"/> <apex:CommandButton action="{!addTermDates}" value="Add" onclick="return checkBlankDate(document.getElementById('{!$Component.termDt}'));"></apex:CommandButton>
        </td>
        <td></td>
    </tr>
    <tr>
        <td colspan="3 align="left">
            <apex:dataTable value="{!allTermDates}" var="a" title="Details of Effective Date" >
                <apex:column >
                     <apex:commandLink value="Remove" action="{!removeTermDates}">
                         <apex:param name="termDates" value="{!a.Id}" />
                     </apex:commandLink>
                </apex:column>
                <apex:column > <span style="padding:15px;"/><apex:outputField value="{!a.Date__c}"/></apex:column>
            </apex:dataTable>
        </td>
    </tr>
    <tr>
        <td colspan="3" align="right">
            <apex:commandButton action="{!nextPage}" value="Continue" styleClass="btn" onclick="return checkEmptyFields(this.form);"></apex:commandButton>
        </td>
    </tr>
</table>    
</apex:pageBlock>

 It throws me an error as soon as I click the Remove link. However the records get deleted on the Remove Link but it throws the error. Kindly advise if I've missed out on anything.
When I do a View Source of the generated page it says that there is an error in a javascript function that is generated by Salesforce. The function name is dpf() and the error is thrown at if (adp != null). The javascript generated code is as under.
Code:
 
 
function dpf(f) {
    var adp = f.adp;
    if (adp != null) {
        for (var i = 0;i < adp.length;i++) {
            f.removeChild(adp[i]);
        }
    }
};
function apf(f, pvp) {
  var adp = new Array();
  f.adp = adp;var ps = pvp.split(',');
  for (var i = 0,ii = 0;i < ps.length;i++,ii++) {
    var p = document.createElement("input");
    p.type = "hidden";  
    p.name = ps[i];
    p.value = ps[i + 1];
    f.appendChild(p);
    adp[ii] = p;i += 1;
  }
};
 
function jsfcljs(f, pvp, t) {
  apf(f, pvp);
  var ft = f.target;
  if (t) {
    f.target = t;
  }
  f.submit();
  f.target = ft; 
  dpf(f);
};

 Are there any constraints on using an apex:commandLink or an apex:dataTable within an HTML table?


Message Edited by kriiyer on 07-29-2008 07:07 AM

It appears the Spring Release 10 Quote Standard Object is not exposed via the Salesforce Metadata API in sandbox or developer Salesforce instances. I cannot view the Quote object in the Force.com Eclipse plugin schema browser. I am experiencing this issue in both a sandbox or developer Salesforce instance. The Quote Standard Object is accessible and exposed via the Salesforce UI interface in both Salesforce instances. Is anyone else experiencing this issue?

  • February 02, 2010
  • Like
  • 0
I want to create resource and public calendar events using Apex. The problem I have ran into is inorder to create an event with Apex and then associate with a resource or public calendar requires the id of of the calendar object which would then be used to populate the ownerid field of the event object. It appears resource and public calendars are defined as users in the user table.
These user table records associated with resource and public though are "hidden" though. It does not seem possible to issue queries for them directly to the user table. Does anyone know a means of making the public and resource calendar users accessible in the user table?
Another question is whether it is possible to expose as an entries in a user lookup (reference) field? The calendar entries do not show up by default.
 
Any assistance is greatly appreciated!
  • April 29, 2008
  • Like
  • 0
#!/usr/bin/perl
use WWW::Salesforce::Simple ;

my $sforce = WWW::Salesforce::Simple->new( username => 'user@domain.com',
                                           password => 'pas$w@rd!' );
print "Connection result: $sforce\n" ;

 I'm unable to get the basic code above to work.  When I run it, either on Linux or on Windows, I get the following message:

Incorrect parameter at /path/to/perl5/lib/perl5/SOAP/Lite.pm line 1993

I'm using EPIC to debug.  The failure is occuring at line 482 of Salesforce.pm:

 

 

    $self->{'sf_sid'}       = $r->valueof('//loginResponse/result/sessionId');

 My debugger shows that there is a value for //loginResponse/result/sessionId.  The valueof function is calling the match method which is calling the _traverse method.  _traverse is recursive, but line 1993 of Lite.pm prevents the recursion tree from gong more than 10 levels deep, which is where my code dies out.

 

I can't, however, quite follow the logic of the _traverse function. Is there a bug there?

 

Hi all,
 
I get a Javascript error (Invalid Argument) while using apex:commandLink. My code is as under:
 
Code:
<apex:pageBlock rendered="{!showFifthSection}">
    <table width="80%">
        <tr>
            <td style="font-weight:bold;" width="20%" valign="top">
                Enter Hi ROC adjustment criteria:
            </td>
            <td width="10%">
                <apex:inputField value="{!contractTerms.ADJ_RT_CRITERIA__c}" />
            </td>
            <td></td>
        </tr>
        <tr>
            <td colspan="3">
                <apex:pageMessage severity="info" strength="1" title="Please include details regarding the criteria for which the Hi-ROC rate reduction or increase would adjust.  Describe any rate adjustment tables, and include references to pages and sections within the contract that explain the rate adjustment criteria.  Include details, such as number of month's notice an account must have before a rate change." />
            </td>
        </tr>
        <tr>
            <td style="font-weight:bold;">Enter effective date(s) Hi-ROC adjustment(s):</td>
            <td><apex:inputField id="termDt" value="{!termDates.Date__c}"/> <apex:CommandButton action="{!addTermDates}" value="Add" onclick="return checkBlankDate(document.getElementById('{!$Component.termDt}'));"></apex:CommandButton>
        </td>
        <td></td>
    </tr>
    <tr>
        <td colspan="3 align="left">
            <apex:dataTable value="{!allTermDates}" var="a" title="Details of Effective Date" >
                <apex:column >
                     <apex:commandLink value="Remove" action="{!removeTermDates}">
                         <apex:param name="termDates" value="{!a.Id}" />
                     </apex:commandLink>
                </apex:column>
                <apex:column > <span style="padding:15px;"/><apex:outputField value="{!a.Date__c}"/></apex:column>
            </apex:dataTable>
        </td>
    </tr>
    <tr>
        <td colspan="3" align="right">
            <apex:commandButton action="{!nextPage}" value="Continue" styleClass="btn" onclick="return checkEmptyFields(this.form);"></apex:commandButton>
        </td>
    </tr>
</table>    
</apex:pageBlock>

 It throws me an error as soon as I click the Remove link. However the records get deleted on the Remove Link but it throws the error. Kindly advise if I've missed out on anything.
When I do a View Source of the generated page it says that there is an error in a javascript function that is generated by Salesforce. The function name is dpf() and the error is thrown at if (adp != null). The javascript generated code is as under.
Code:
 
 
function dpf(f) {
    var adp = f.adp;
    if (adp != null) {
        for (var i = 0;i < adp.length;i++) {
            f.removeChild(adp[i]);
        }
    }
};
function apf(f, pvp) {
  var adp = new Array();
  f.adp = adp;var ps = pvp.split(',');
  for (var i = 0,ii = 0;i < ps.length;i++,ii++) {
    var p = document.createElement("input");
    p.type = "hidden";  
    p.name = ps[i];
    p.value = ps[i + 1];
    f.appendChild(p);
    adp[ii] = p;i += 1;
  }
};
 
function jsfcljs(f, pvp, t) {
  apf(f, pvp);
  var ft = f.target;
  if (t) {
    f.target = t;
  }
  f.submit();
  f.target = ft; 
  dpf(f);
};

 Are there any constraints on using an apex:commandLink or an apex:dataTable within an HTML table?


Message Edited by kriiyer on 07-29-2008 07:07 AM
Hi folks

I wanted to enforce the Users object (standard sf object) so that we can't have duplicate "Alias" entries since we key off certain reports and views based on the User Alias field.

I was able to write a basic trigger code and a basic public class to execute it. But when I try to write a testmethod for it, I am getting
all sorts of errors about not being able to do this and that with Users.

So, my trigger code is straight forward:
trigger UserAliasDuplicatePreventer on User (before insert, before update) {
EnsureUniqueUserData.checkUniqueUserAlias(Trigger.new);
}

And all it does is call on this apex class EnsureUniqueUserData and the method in it checkUniqueuserAlias.
And the logic works fine when I am just testing it out directly in sandbox by updating/creating new User entries with same Alias value.

public class EnsureUniqueUserData
{

public static void checkUniqueUserAlias (User[] users)
{
for (User u:users)
{
for (User Existusers : [select id,Alias,Name from User where Alias = :u.Alias])
{
// If there is a match
// System.assertEquals(Existusers.name,null);
u.addError('An User with this Alias already exists!');
}
}
}

static testmethod void testUniqueUserAlias()
{

User User1 = new User (Name = 'test user1', Alias = 'testu');
insert User1;
// make sure User is created
System.assert(User1.id != null);

// Now create a 2nd User entry that uses same Alias, it should fail
User User2 = new User (Name = 'test user2', Alias = 'testu');
insert User2;
// make sure User is created
System.assertEquals(User2.id,null);


// Now delete the 1st User entry with the testu alias and try again, it should work now

delete User1;
User User3 = new User (Name = 'test user3', Alias = 'testu');
insert User3;
// make sure User is created
System.assert(User3.id != null);
System.assertEquals(User3.Alias,'testu');

}


The problem is when I try to save the testmethod code, it complained with this:
Error: Compile Error: Field is not writeable: Name at line 20 column 34

I try to change my creation of user entry so that instead of:

User User1 = new User (Name = 'test user1', Alias = 'testu');
insert User1;

I just use:

User User1 = new User (Alias = 'testu');
insert User1;

But now it complains on the insert statement with message:
Error: Compile Error: DML not allowed on User at line 21 column 4


How  can I get this into production if the unit testing doesn't seem to be working properly (i.e. are there restrictions on the
Users object because that's how salesforce is essentially creating sf login)??

thx in advance for your help.