• gsickal
  • NEWBIE
  • 35 Points
  • Member since 2006

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 75
    Questions
  • 145
    Replies
Hi

I am using a simple Apex trigger to prevent the insertion and updating of certain records when they are duplicates and meet a few other criteria.  This is simple enough.  I basically copied the example out of the Force.com Cookbook for preventing the insertion of Leads with duplicate E-mail addresses.

There are a few cases where my client would like duplicate insertion and updating allowed, but to be preceeded by a simple alert nortification (similar to Javascript's alert).  Is there a way to do this with Apex?

Thanks!

Michael

Position: C# .NET/Word Developer

 

 

This person will be responsible for designing and writing code in C#, VB.NET, the Word object model and WordXML to fix bugs as well as introduce new functionality into our Salesforce.com based products
 

Requirements:

·         Understand the requirements behind new product features

·         Fix bugs and develop new features using C#, VB, and XML

·         Write applications that interface with Microsoft Word using C#, XML, and Microsoft WordXML

Qualifications:

·         Minimum 3 years experience with C#.NET. VB.NET, and Word VBA programming required

·         Experience creating ActiveX components and COM Dlls for Word

·         Experience with the Word 2003/2007 Object Models required

·         Experience writing addins for Word using VBA required

·         Experience with SQL and XML required

·         Knowledge of the Salesforce and Office Toolkit APIs desired

·         Ability to work independently on product enhancements

·         Ability to quickly turn around new features and test thoroughly

Apply for this Job

 Position: Apex Developer

 

This person will be responsible for fixing bugs and adding new features to the product using the Salesforce Apex and VisualForce technologies. Apex is a powerful server side language unique to Salesforce that allows developers to write complex business logic that lives on the server.
 

Requirements:

·         Understand the requirements behind new product features from product management

·         Fix bugs in existing Apex code and develop new product features using the Apex and Visual Force Toolkits

·         Create Apex  and Visual Force code to implement new functions in the product

Qualifications:

·         Minimum 1 years experience with Apex code

·         Minimum 3 years experience with Java

·         Knowledge of the Salesforce API required

·         Knowledge of Java and object oriented concepts required

·         Ability to quickly turn around new features and test thoroughly

·         Ability to work independently on product enhancements

 

Apply for this Job

 

I am trying to redeploy an sforce component using the latest toolkit plugin for eclipse and when I do this I get the following error message:
 
Unable to deploy force.com components.
Reason:
ServiceException: Operation time out - polling limited (300000 milliseconds) reached
Operation time out - polling limited (300000 milliseconds) reached
  com.salesforce.toolkit.ui.wizards.deploy.DeploymentResultsPage$1.run (DeploymentResultsPage.java 66)
  org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java 113)
 
Why is this happening?  Is there an eclipse setting I can change to fix this?  thanks
I tried to create an EmailTemplate in apex but got the message "Save Error: DML not allowed on EmailTemplate".  Is there a reason we cannot create or update email templates in apex now or any other way to do this?

Is there a limit to the number of profiles that can be packaged in a managed app?  I tried adding some new profile to a managed package that previous had a single custom profile I had added but they aren't getting added in the target installation.  Are we limited to packaging a single profile?

I am getting the message above when I try to create a virtual class than can be overridden in my developer environment.  Page 71 of the apex developer's guide says "Note: abstract and virtual are not enabled for all organizations.  If you need them for your application, contact your salesforce.com representative".  When I contacted support, no one seems to know anything about this, even though it is clearly stated several times on pages 71-80 of the apex developers's guide.  Is this feature not available yet?  How do I get this enabled as soon as possible?  thanks
I know that describe info is not currently available in apex so we cannot get the list of fields for a custom object dynamically at runtime, but is there any support now or planned for a select * capability within Apex?

.NET Developer

 

 

This person will be responsible for designing and writing code in C# and VB.NET to fix bugs as well as introduce new functionality into our Salesforce.com based product
 

Requirements:

  • Understand the requirements behind new product features from product management
  • Fix bugs and develop new features using C# and VB.NET
  • Write applications that interface with Microsoft Word using C# and VB.NET

Qualifications:

  • Knowledge of the Salesforce API and Office Toolkit API required
  • Minimum 3 years experience with C#.NET and VB.NET programming required
  • Experience creating ActiveX components and COM DLLs for Windows applications
  • Experience with the Word 2003 Object Model required
  • Experience with SQL and XML required
  • Ability to work independently on product enhancements
  • Ability to quickly turn around new features and test thoroughly

Send response to jobs at apttus dot com



Message Edited by gsickal on 02-01-2008 08:35 AM

Message Edited by gsickal on 02-07-2008 07:05 AM

Apex Developer

 

You will be responsible for adding new features to a contract management product using Salesforce Apex and VisualForce technologies.   We are currently looking for either a full time employees or a consultant.  

 

 

Requirements:

  • Understand the requirements behind new product features from product management
  • Fix bugs in existing Apex code and develop new product features using the Apex and Visual Force Toolkits
  • Create Apex and Visual Force code to implement new functions in the product

Qualifications:

  • Minimum 1 years experience with Apex code
  • Minimum 3 years experience with Java
  • Knowledge of the Salesforce API required
  • Knowledge of Java and object oriented concepts required
  • Ability to quickly turn around new features and test thoroughly
  • Ability to work independently on product enhancements

     Please respond to jobs at apttus dot com

 



Message Edited by gsickal on 02-01-2008 08:34 AM

Message Edited by gsickal on 02-07-2008 07:06 AM
Is there a way to call the emailauthor page from within an scontrol and pass it not one, but two document ids?  Passing a single document id works, but I need it to work for multiple document ids.
 

emUrl = "/email/author/emailauthor.jsp?doc_id="+doc_id+"&retURL="+gObjectIdURL+"&p3_mlktp="+p3_mlktp+"&p3_lkid="+p3_lkid+"&p3_lkold="+p3_lkold;

is there a sample using a relationship query in .net you can point me to?  I have looked all through the forums but can’t find anything for .net… I have something like this from the samples…

Code:

private string getFieldValue(string fieldName, System.Xml.XmlElement[] fields) {
    string returnValue = "";
    if (fields != null) {
        for (int i = 0; i < fields.Length; i++) {
            if (fields[i].LocalName.ToLower().Equals(fieldName.ToLower())) {
                returnValue = fields[i].InnerText;
            }
        }
    }
    return returnValue;
}

My function…
 
string q = "Select a.Id,a.Name,a.Field1__c,a.Field2__c," +
    "(Select d.Id,d.Name,d.Related_Field1__c,d.Related_Field2__c From MyRelatedObject__r d) " +
    "From MyCustomObject__c a";

QueryResult qr = m_binding.query(q);
sObject sobj = null;

for (int i=0; i<qr.records.Length; i++) {
    sObject record = qr.records[i];

    string objId = getFieldValue("Id", record.Any);
    string objName = getFieldValue("Name", record.Any);
    string objField1 = getFieldValue("Field1__c ", record.Any);
    string objField2 = getFieldValue("Field2__c ", record.Any);

    //how do I access the related object query results—
    //can I use QueryResult again or do I have to use xml methods to get at the sub results–
    //I want to get at the fields below…
    string relatedObjId = getFieldValue("Id", subrecord.Any);
    string relatedObjName = getFieldValue("Name", subrecord.Any);
    string relatedObjField1 = getFieldValue("Related_Field1__c", subrecord.Any);
    string relatedObjField2 = getFieldValue("Related_Field2__c", subrecord.Any);


 

Thanks for any help you can provide as I am stuck…

I created a new extension package in an account, uploaded it, and tried to install it to another account that had the dependent package. When I tried the install, it failed without any deascriptive errors below. Why is the install of this package failing?  Is there any way to find out more descriptive errors of why a package installation fails?

Install failed
Your requested download failed. Please try this again.

None of the data or setup information in your Salesforce organization should have been affected by this error.

If this error persists, contact Support through your normal channels.

I want to create a mechanism where users can easily override or extend code at runtime in scontrols that gets installed as part of a managed package.  Since those scontrols cannot be edited like other things in a managed package,  I put hooks that call these override functions from another code snippet I want to include.  What I want is the ability to put a merge field containing the name of the snipped in an include statement like this:

 

{!INCLUDE($SControl.{!MyCustomObject.SControlName__c})}

 

But this doesn’t work.  Is there another way to do this or has anybody come up with a way to allow users to extend scontrols that are part of managed packages?

 

For example, my read only managed package scontrol might look like this.  When the page loads, the alert “fooBar” pops up.  If the user has supplied a function called “_fooBar” in the scontrol that gets included, then the additional alert “_fooBar” pops up:

 

MyCustomSControl.scf

 

Code:
<script src="/soap/ajax/10.0/connection.js"></script>
{!INCLUDE($SControl.MyIncludeFunctions)}
{!INCLUDE($SControl.{!MyCustomObject.SControlName__c})}

<script language="javascript" type="text/javascript"> 

function initPage() {
  gCustomSControl = "{!MyCustomObject.SControlName__c}";

  //run default method in this script
  fooBar();   

  //run override method in another script
  try {
      _fooBar();
  }
  catch(ex) {
  }
}
function fooBar() {
  alert(“fooBar”);
}
</script>
<body onload="initPage()">
</body>

And the scontrol that users create and put their custom code in looks like this:

 

MyCustomSControl_Override.scf


Code:

<script src="/soap/ajax/10.0/connection.js"></script>
<script language="javascript" type="text/javascript"> 
function _fooBar() {
  alert(“_fooBar”);
}
</script>

Message Edited by gsickal on 09-19-2007 03:47 PM

  • September 19, 2007
  • Like
  • 0
Can you remove the Edit and Del checkbox action links from a related list?  I want to remove the X Edit | X Del links under the action column.  How can I do this in a related list for a custom object?
  • September 06, 2007
  • Like
  • 0
I want to put a file url (file://host/path/filename.pdf) that points to a file on my local network in a field of type url so when a user clicks on it in a custom object detail view, it links to the document and opens it in the same way as a normal hyperlink using the http:// protocol.  When I do this though, the text "http://" gets appended to the field and it ends up looking like (http://file://host/share/filename.pdf) which doesn't work.  How can I make this work?
 

Message Edited by gsickal on 08-27-2007 07:34 AM

How can you retrieve ProcessInstanceHistory records in an scontrol?  The docs say you can't use query but need to use the describeobject call which returns a query result for each processinstance.  When I try this it doesn't seem to work, all I can see are fields and the normal describe metadata info... How can I retrieve history records using the line
 
var dso = sforce.connection.describeSObject("ProcessInstanceHistory");

Message Edited by gsickal on 08-22-2007 04:51 PM

I have read in numerous places that as of Summer 07 Apex is only GA in Developer and Unlimited Edition accounts.  However, a friend is telling me it is possible as of Summer 07 to develop Apex in a DE account and deploy it to an Enterprise Edition account?  Is this possible?  If so, where is this process described?  Thanks
How can I get the user's department (from the standard User object) pulled into a report?  It seems to be missing.  Any way to pull in these extended fields?
Is there a bug in processSubmitRequest?  I have a process that requires the  approver to be manually chosen but when I run the processSubmitRequest on this I get an error saying a required field is missing.  If I try to set the nextOwnerId it doesn't work either.  Is this a bug or if manual requests are not supported is there a graceful way to determine this and report it back to users instead of displaying a message implying a field is missing?  Here is the syntax:
 
Code:
var request = new sforce.ProcessSubmitRequest();
request.objectId = id;
//request.nextOwnerId = approverIds;
//request.comment = "Test Process Submit Request";

var requests = new Array(1);
requests[0] = request;

var results = sforce.connection.process(requests);

 
 
 
Can email approvals use unicode or other languages for the words "APPROVE, APPROVED, YES, REJECT, REJECTED, or NO" that are included in the first line of the email?  Can comments in the second line also be in another language (i.e. unicode) as well?
I want to put a file url (file://host/path/filename.pdf) that points to a file on my local network in a field of type url so when a user clicks on it in a custom object detail view, it links to the document and opens it in the same way as a normal hyperlink using the http:// protocol.  When I do this though, the text "http://" gets appended to the field and it ends up looking like (http://file://host/share/filename.pdf) which doesn't work.  How can I make this work?
 

Message Edited by gsickal on 08-27-2007 07:34 AM

Hi

I am using a simple Apex trigger to prevent the insertion and updating of certain records when they are duplicates and meet a few other criteria.  This is simple enough.  I basically copied the example out of the Force.com Cookbook for preventing the insertion of Leads with duplicate E-mail addresses.

There are a few cases where my client would like duplicate insertion and updating allowed, but to be preceeded by a simple alert nortification (similar to Javascript's alert).  Is there a way to do this with Apex?

Thanks!

Michael
Hi all
 
I'm having trouble with an Apex trigger that I've created. I used the leadDuplicatePreventer trigger in the Force.com cookbook and edited to involve checking a user alias is unique. When I edited this in my Sandbox environment it worked correctly and I had no problem. Now I'm trying to implement this into my Production environment via Eclipse and I seem to be running into trouble. 1st of all I get an error message that the test coverage is 0% (despite being working in Sandbox) and 2nd when I have tried to edit the trigger to active and I receive messages that the trigger is only saved locally, not to server. How come this happens? Why does it work on Sandbox and not on the Production environment?
 
The code ;)

trigger UserAliasDuplicatePreventer on User (before insert, before update)

{Map<String, User> userMap = new Map<String, User>();

for (User user : System.Trigger.new)

{if ((user.Alias != null) && (System.Trigger.isInsert || (user.Alias != System.Trigger.oldMap.get(User.Id).Alias)))

{if (userMap.containsKey(user.Alias))

{user.Alias.addError('Another new user has the same alias.');}

else {userMap.put(user.Alias, user);}}}

for (User user : [SELECT Alias FROM User WHERE Alias IN :userMap.KeySet()])

{User newUser = userMap.get(user.Alias);newUser.Alias.addError('A user already has this alias.');}}

 
  • April 01, 2008
  • Like
  • 0
I've got a multi-line field and I want its value in a JavaScript variable. I would like to avoid unnecessary network requests.

var value = "{!Foobar.field}";

Doesn't work as it's a multi-line field and JavaScript doesn't support literal strings with unescaped newlines. I tried this:

var value = "{!SUBSTITUTE(SUBSTITUTE(Foobar.field, "\n", "\\n"), "\r", "\\r")}";

The documentation is silent on escape sequences in strings, but \" works in SUBSTITUTE so I rashly assumed that the standard set of escape sequences would all work. But they don't; SUBSTITUTE apparently hasn't heard of \n and \r.

I've tried \012, \x0a and \u000a and get syntax errors for my trouble. Is there a way of doing what I want?

.NET Developer

 

 

This person will be responsible for designing and writing code in C# and VB.NET to fix bugs as well as introduce new functionality into our Salesforce.com based product
 

Requirements:

  • Understand the requirements behind new product features from product management
  • Fix bugs and develop new features using C# and VB.NET
  • Write applications that interface with Microsoft Word using C# and VB.NET

Qualifications:

  • Knowledge of the Salesforce API and Office Toolkit API required
  • Minimum 3 years experience with C#.NET and VB.NET programming required
  • Experience creating ActiveX components and COM DLLs for Windows applications
  • Experience with the Word 2003 Object Model required
  • Experience with SQL and XML required
  • Ability to work independently on product enhancements
  • Ability to quickly turn around new features and test thoroughly

Send response to jobs at apttus dot com



Message Edited by gsickal on 02-01-2008 08:35 AM

Message Edited by gsickal on 02-07-2008 07:05 AM
Is there a way to call the emailauthor page from within an scontrol and pass it not one, but two document ids?  Passing a single document id works, but I need it to work for multiple document ids.
 

emUrl = "/email/author/emailauthor.jsp?doc_id="+doc_id+"&retURL="+gObjectIdURL+"&p3_mlktp="+p3_mlktp+"&p3_lkid="+p3_lkid+"&p3_lkold="+p3_lkold;

Hello,
 
please help with my little problem using mail merge fields from Opportunity_LineItem in Word tables. The problem occurs only in word tables. I want to get all opportunity LineItems from one opportunity in one Word table. I'm using Opportunity_LineItem_Start and Opportunity_LineItem_End. It works wonderfull but if I put two fields in one cell of the table there is a strange behaviour of the mergefields:
What I write in one cell: <<Opportunity_LineItem_UnitPrice>> <<Opportunity_LineItem_Quantity>>
What I get is: 100 € <<Opportunity_LineItem_UnitPrice>> 1
What I want is: 100 € 1
This is an simplified example and demonstrates the problem really good.
 
I'm using Word 2003 with the recent SForceOffice Integration.
 
Perhaps this is a bug of Office Integration. Is there any workaround? Does anyone knows this problem?
 
Thanks!
Jochen

is there a sample using a relationship query in .net you can point me to?  I have looked all through the forums but can’t find anything for .net… I have something like this from the samples…

Code:

private string getFieldValue(string fieldName, System.Xml.XmlElement[] fields) {
    string returnValue = "";
    if (fields != null) {
        for (int i = 0; i < fields.Length; i++) {
            if (fields[i].LocalName.ToLower().Equals(fieldName.ToLower())) {
                returnValue = fields[i].InnerText;
            }
        }
    }
    return returnValue;
}

My function…
 
string q = "Select a.Id,a.Name,a.Field1__c,a.Field2__c," +
    "(Select d.Id,d.Name,d.Related_Field1__c,d.Related_Field2__c From MyRelatedObject__r d) " +
    "From MyCustomObject__c a";

QueryResult qr = m_binding.query(q);
sObject sobj = null;

for (int i=0; i<qr.records.Length; i++) {
    sObject record = qr.records[i];

    string objId = getFieldValue("Id", record.Any);
    string objName = getFieldValue("Name", record.Any);
    string objField1 = getFieldValue("Field1__c ", record.Any);
    string objField2 = getFieldValue("Field2__c ", record.Any);

    //how do I access the related object query results—
    //can I use QueryResult again or do I have to use xml methods to get at the sub results–
    //I want to get at the fields below…
    string relatedObjId = getFieldValue("Id", subrecord.Any);
    string relatedObjName = getFieldValue("Name", subrecord.Any);
    string relatedObjField1 = getFieldValue("Related_Field1__c", subrecord.Any);
    string relatedObjField2 = getFieldValue("Related_Field2__c", subrecord.Any);


 

Thanks for any help you can provide as I am stuck…

Has anyone been able to use the {IF} in Word's mailmerge to conditionally include text based on a value returned from Salesforce?
 
For example:
{ IF «OPPORTUNITY_NUM_SVCS_DEFINED» <> "1" "Some conditional text." " " }
 
The example from Microsoft shows:
{ IF {MERGEFIELD Country \* Caps } <> "United Kingdom" "We offer special rates on travel to the British Isles." " " }
 
Which I have successfully used before.
 
  • November 05, 2007
  • Like
  • 0

Hi,

Can anyone please suggest a better way to do this:

We have an Object in javascript(in S-control) that stores the following details related to an email: email Accountowner and email_content. But we need to send only one email per Accountowner with all the contents for that owner. To do this I need to sort this object array by Account Owner. How can we sort such an Object Array by Account Owner:

The sample email object is as shown below:

emailObj= new Object();
emailObj.to=AccountOwner;
emailObj.content=email_content;

The above object will be populated for all rows in the report that may/maynot have multiple records for the same AccountOwner. So the basic question is: in order to sent a single email to the Account Owner with all his related contents, how can we sort this Object Array? Also is there any other way to acheive this as I cannot sort the report by AccountOwner name due to some other constraints?

Appreciate all your feedbacks on this.
Thanks,
Ambili

  • November 05, 2007
  • Like
  • 0
Hi All,
 
I have created a button and on click of this i am trying to save a .txt file in to my local machine. PFB the code. But when i execute this, i am getting the following error.
Error: Number:-2146827859 Description:Automation server can't create object
 
Any solution on this will b really helpful.
 
Thanks,
Udaya
 
Code:
<html> 

<head> 

<script src="/soap/ajax/9.0/connection.js" 

type="text/javascript"></script> 

<script> 
function WriteToFile() { 
try { 
var fso, s; 
fso = new ActiveXObject("Scripting.FileSystemObject"); 
s = fso.CreateFolder("C:\\test.txt", true); 
s.writeline("This is a test"); 
s.Close(); 
} 
catch(err){ 
var strErr = 'Error:'; 
strErr += '\nNumber:' + err.number; 
strErr += '\nDescription:' + err.description; 
document.write(strErr); 
} 
} 
</script> 
</head> 

<body onload="WriteToFile()"> 

<div id="output"> </div> 

</body>

 
Hello,
 
On the Opps page we use a second field that can handle formula calcuations to calculate the final value that we need in the AMOUNTS field (the key field that SF uses for forecasting). Then we have created a S-Control that passes the caculated value into the AMOUNTS field based on the user´s role when the go into the Opportunity.
 
The javascript works fine and only works for the user roles we have identified but with one big problem. It only works if the person is a Sys Admin. It will not execute the S-Control if the person is a Standard User.
 
Any ideas on how to solve this. We have the Pro Version.
 
Here is the S-Control . . .
 
<script language="JavaScript">
// Check the roles allowed to do this
var myrole = "{!$UserRole.Name}";
if(myrole == 'Marketing Manager' || myrole == 'Client Services Manager' || myrole == 'Client Services Assistant Manager' || myrole == 'Client Services Admin' || myrole == 'CRM Manager' || myrole == 'Operations Director' || myrole == 'Broker Sales Manager')
{
    var theformula = "{!Opportunity.Amount_Formula_Result__c}";
    var theamount = "{!Opportunity.Amount}";
    // If they are not the same (which they should be) then enter here
    if(theformula != theamount)
    {
        // Loop across the formula field and remove anything thats not a number, comma or full stop
        for (var i=0, currencyasnumber ='', valid="1234567890.,"; i<theformula .length; i++)
        if (valid.indexOf(theformula .charAt(i)) != -1)
        currencyasnumber += theformula .charAt(i);
        updwindow = window.open('/{!Opportunity.Id}/e?retURL=%2F{!Opportunity.Id}&opp7=' + currencyasnumber + '&save=1','mywindow','width=100,height=100,location=1,status=1,scrollbars=1');
        setTimeout('updwindow.close()',1500);
        var retURL = escape("/{!Opportunity.Id}");
        setTimeout('parent.frames.location.replace("https://emea.salesforce.com" + retURL)',2000);
    }
}
</script>
I want to run an s-control that will be invoked by a standard user, but the s-control needs to update a field that's only accessible to an administrator... is there a way to "log-in" as an administrator in the background so the s-control can run? I thought you can do something with a session id of an admin, but wouldn't that expire eventually? Someone please help, thanks! -Brad
  • September 21, 2007
  • Like
  • 0
hi i have set up a custom object to hold some customer data linked to the account
 
within the custom object i have made a custom-s control and included the fields i want to export, but how do I get it to open up the data i have selected in a word document ?
 
i basically want to click on an export button within one of the custom object tabs and word will open with the content from those fields populated in word
 
is this possible without having to purchase a subscription to one of the add-on app-exchange modules ?
 
thanks
Hello everybody
I have a problem with accesing a ms word document from within S-control

     var w=new ActiveXObject('Word.Application');
var docText;
var documentUrl="/servlet/servlet.FileDownload?file=01570000000ZGR2";
var obj;
if (w != null)
    {
    w.Visible = true;
    w.Documents.Open(documentUrl);

I get "file is corrupted" error, but if i download and open the file that URL points to it works fine...
Anybody now a way around it?