• hassab
  • NEWBIE
  • 50 Points
  • Member since 2010

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 18
    Replies

Hello,

 

I had a simple javascript button that worked fine for months.  It now suddenly doesn't work.  I have seen something about protoype causing this error but as far as I'm aware I haven't done anything with prototype and haven't added any new functionality in a while.  any idea why we might be getting this error? 

 

Button:

{!REQUIRESCRIPT("/soap/ajax/8.0/connection.js")}

var conRecord = new sforce.SObject("Contract");
conRecord.id = "{!Contract.Id}";

if ('{!$Profile.Name}'=='System Administrator'||'{!$Profile.Name}'=='Legal Admin'||'{!$Profile.Name}'=='Contract Manager'){
conRecord.Status = "Cancelled";
conRecord.Name = "CANCELLED - " + '{!Contract.Name}';
}
else {
conRecord.Status = '{!Contract.Status}';
conRecord.Name = '{!Contract.Name}'
}

var result = sforce.connection.update([conRecord]);

if (result[0].getBoolean("success"))
{
// Refresh window
window.location.reload();
}
else
{
alert("You do not have permission to cancel this contract");
}

 

 

Here's the complete error I'm getting:

 

faultcode:'soapenv:Client', faultstring:'Attribute "xmlns" bound to namespaces "http://www.w3.org/2000/xmlns/" was already specified for element "update"'

Thanks in advance!

 

-Hassab

  • March 08, 2011
  • Like
  • 0

Hello,

 

Can anyone give me the total number of workflows and approval processes an org in Enterprise Edition can have?  How many active & inactive and does the limit apply to workflows and approvals in total or x amount for workflows and x amount for approvals?

 

Thanks,

Hassab

  • December 14, 2010
  • Like
  • 0

Anyone have any idea on how to restrict access to reporting on objects by record type?  Here's our situation - with almost all of our standard objects we need people to be able to see the full record on one set of record types or on the records they own but a restricted view on the remaining records.  Basically they need to be aware that the record exists and see basic information on it, but be restricted from viewing sensitive data.  This is particularly needed in contracts.  I am able to achieve this with a view all and view only layout assigned in the appropriate way to each profile, but the trouble is the user can just create a report and see all the data anyway.  I don't want to restrict the ability to create reports entirely, because they need to be able to pull lists on the fly for their own data.  I just don't want them to be able to report on the record types they don't have access to in their profile. 

 

Barring that, I'd like them to only be able to view records, but not report on them, for specific objects.  Is there any way to do either of these?

 

Thanks,

Hassab

  • September 22, 2010
  • Like
  • 0

hello all,

 

I am trying to create a custom button on a standard page that redirects to one or the other external url based on a value in the record.  So far I have not been able to get sf to do this - and if statement in javascript keeps giving me errors (don't know javascript that well so that could be my fault).  Any ideas?

 

-Hassab

  • September 07, 2010
  • Like
  • 0

Hi all,

 

Is it possible to have a case statement in a SOQL query?  I am attempting to combine multiple lookup fields that are various contacts associated with a contract into a single related list, where the list would contain the specific role of the contact (signee, contractee, a few custom fields, etc.).  Is SQL i'd do this with a case statement but SOQL doesn't seem to like it.  Any thoughts?  Here's my query:

 

Select id, Name, Status, Amount__c, Contract_Date__c
            from Contract 
            where CompanySignedID = :con.id
                or OwnerID = :con.id
                or CustomerSignedID = :con.id

                or Consultant__c = :con.id
                or Signee__c = :con.id
                or Organization_Contact__c = :con.id

 

If SOQL doesn't do case statements, any ideas how I could designate which of these fields the contact is assiged to?

 

Thanks,

Hassab

  • August 09, 2010
  • Like
  • 0

Hello all,

 

I have a custom related list build on VF extending a standard controller.  All seems to be working well but I have 2 things I'd like to add:

 

1 - how does one go about implementing a case statement or an if-then-else statement to display the role a person might have with the object.  For example, my related list pulls all the contracts a person might be related to.  However that person could be the signee, the company contact, the company signed by or the person assigned to a handful of custom lookup fields associated with the contract.  Under normal circumstances I would build a case statement in the SQL query to pull the role the person has with the record, but SOQL doesn't seem to like that.  Doesn't seem to like an if statement either.  Does anyone have any ideas?  Here's my controller:

 

public with sharing class constituentDetailsController {

    private List<Contract> contracts;

    private Contact cntact;

    public constituentDetailsController (ApexPages.StandardController controller) {

        this.cntact= (Contact)controller.getRecord();

    }

    public List<Contract> getContracts()

    {

        Contact con = [Select id FROM Contact where id = :cntact.id];

        if (con.id == null)

         return null;

          contracts = [Select id, Name, Status, Amount__c, Contract_Date__c

                                    from Contract

                                    where CompanySignedID = :con.id

                                                or OwnerID = :con.id

                                                or CustomerSignedID = :con.id

                                                or Artist__c = :con.id

                                                or Consultant__c = :con.id

                                                or Signee__c = :con.id

                                                or JALC_Signee__c = :con.id

                                                or Organization_Contact__c = :con.id

 

            ];

        return contracts;

    }

 

2.  I have added an edit link to the related list so that a person can get to the edit page of the contract record.  How can I either hyperlink or add a "view" link to the list so that they can just get to the details page?

 

Thanks in advance!

 

-Hassab

Hello,

 

I have written a controller to prepopulate a visualforce page.  The controller works fine in sandbox, and when I run through the steps is prepopulates perfectly in the browser but when I try to run tests it tells me the field is not writable.  I seem only to have this problem with lookup fields, when I remove those it compiles, tests and deploys fine.  I tried also prepopulate those using the url but visualforce pages have very odd field ids and the url seems not to understand them.  Does anyone have any suggestions?  Here' s my controller:

 

public class addContactAffiliation {
 Public npe5__Affiliation__c affil;
 Public Contact contact;
 Public string AccountID = System.currentPagereference().getParameters().get('AccountID');
 Public string ContactID = System.currentPagereference().getParameters().get('ContactID'); 
 
    public npe5__Affiliation__c getAffil() {
      if(affil == null) affil = new npe5__Affiliation__c();
      contact = [select Name, LastName, id, npe01__WorkEmail__c,
                      npe01__Workphone__c, npe01__AlternateEmail__c,mobilephone,
                      otherphone, work_fax__c, mailingcity, mailingcountry,
                  mailingpostalcode, mailingstate, mailingstreet from contact where Id =:      

    contactId];
           
          affil.npe5__Contact__c = contact.name;
          affil.email__c = contact.npe01__WorkEmail__c;
          affil.office_phone__c = contact.npe01__Workphone__c;
          affil.email_2__c = contact.npe01__AlternateEmail__c;
          affil.cell_phone__c = contact.mobilephone;
          affil.alt_phone__c = contact.otherphone;
          affil.street__c = contact.mailingstreet;
          affil.city__c = contact.mailingcity;
          affil.state__c = contact.mailingstate;
          affil.zip__c = contact.mailingpostalcode;
          affil.country__c = contact.mailingcountry;
          affil.fax__c = contact.work_fax__c;
             
      return affil;
   }

 

Really appreciate your help - it's so frustrating to get to this point and not to be able to prepopulate the most important field!

Hi all,

 

I am relatively new at this and I have a simple Apex clas in the non-profit version I am trying to deploy.  The class itself has passed with 91% coverage but its inserting a contact and I'm getting low coverage on other classes that I am guessing are getting triggered by the insert.  I'm not sure we need these triggers and I have been wanting to turn them off, but figured I'd wait a while to be sure.  My question is, do I need to build tests in my method for these classes or is there something that needs to be done in the classes themselves?

 

Thanks,

H

Hi all,

 

I am working with the non-profit version which uses an affiliation table to connect multiple contacts with multiple accounts.  This functionality is actually quite burdensome to some of our users and I am trying to find a way to simplify it.  I thought of 2 things - fill out all contact information on the affiliate table and update to the contact table, or create the contact first, and autopopulate to the affiliate.  There are issues with both scenarious I am as of yet unable to resovle.

 

Of the first, when a user fills out the affiliate table, the contact is a required field to save, therefore the functionality must create the contact before saving the affiliate record.  Unfortunately the quick create from the lookup table only gives about half the fields we need, so the user has to create the account, then create the contact separately, then connect the two.  If I could pass unsaved data into a new contact record via url, the user could type in all the info into the affiliate record, then click  button to create the contact and have the contact name autofill back to the affiliate, but I have not been able to successfully pass unsaved data to a new contact record.

 

On the second, I tried creating a set of visualforce pages that walk through the process - create the contact, then the affilation record autopopulates, but I am stuck at getting the visualforce page to save and redirect, autopopulating into a new contact record.

 

Does anyone have any experience with resolving this issue or any guidance about the best direction to go in?  I'd love to avoid making a whole trigger/method thing out of this if possible...

 

Thanks,

Hassab

I am trying to come up with a way to export mail merged documents, either by emailing them out of the attachments table (after they are put there by conga merge) or by emailing a mail merged document from a record.  I am able to set up email triggers, but the attachments seem to only allow me to pull from the documents object, not from the mail merge document.  I am also not seeing any way to forward attachments to a destination via triggered outboung email.  Any ideas?

  • April 08, 2010
  • Like
  • 0

Anyone have any idea on how to restrict access to reporting on objects by record type?  Here's our situation - with almost all of our standard objects we need people to be able to see the full record on one set of record types or on the records they own but a restricted view on the remaining records.  Basically they need to be aware that the record exists and see basic information on it, but be restricted from viewing sensitive data.  This is particularly needed in contracts.  I am able to achieve this with a view all and view only layout assigned in the appropriate way to each profile, but the trouble is the user can just create a report and see all the data anyway.  I don't want to restrict the ability to create reports entirely, because they need to be able to pull lists on the fly for their own data.  I just don't want them to be able to report on the record types they don't have access to in their profile. 

 

Barring that, I'd like them to only be able to view records, but not report on them, for specific objects.  Is there any way to do either of these?

 

Thanks,

Hassab

  • September 22, 2010
  • Like
  • 0

hello all,

 

I am trying to create a custom button on a standard page that redirects to one or the other external url based on a value in the record.  So far I have not been able to get sf to do this - and if statement in javascript keeps giving me errors (don't know javascript that well so that could be my fault).  Any ideas?

 

-Hassab

  • September 07, 2010
  • Like
  • 0

Hello,

 

I have written a controller to prepopulate a visualforce page.  The controller works fine in sandbox, and when I run through the steps is prepopulates perfectly in the browser but when I try to run tests it tells me the field is not writable.  I seem only to have this problem with lookup fields, when I remove those it compiles, tests and deploys fine.  I tried also prepopulate those using the url but visualforce pages have very odd field ids and the url seems not to understand them.  Does anyone have any suggestions?  Here' s my controller:

 

public class addContactAffiliation {
 Public npe5__Affiliation__c affil;
 Public Contact contact;
 Public string AccountID = System.currentPagereference().getParameters().get('AccountID');
 Public string ContactID = System.currentPagereference().getParameters().get('ContactID'); 
 
    public npe5__Affiliation__c getAffil() {
      if(affil == null) affil = new npe5__Affiliation__c();
      contact = [select Name, LastName, id, npe01__WorkEmail__c,
                      npe01__Workphone__c, npe01__AlternateEmail__c,mobilephone,
                      otherphone, work_fax__c, mailingcity, mailingcountry,
                  mailingpostalcode, mailingstate, mailingstreet from contact where Id =:      

    contactId];
           
          affil.npe5__Contact__c = contact.name;
          affil.email__c = contact.npe01__WorkEmail__c;
          affil.office_phone__c = contact.npe01__Workphone__c;
          affil.email_2__c = contact.npe01__AlternateEmail__c;
          affil.cell_phone__c = contact.mobilephone;
          affil.alt_phone__c = contact.otherphone;
          affil.street__c = contact.mailingstreet;
          affil.city__c = contact.mailingcity;
          affil.state__c = contact.mailingstate;
          affil.zip__c = contact.mailingpostalcode;
          affil.country__c = contact.mailingcountry;
          affil.fax__c = contact.work_fax__c;
             
      return affil;
   }

 

Really appreciate your help - it's so frustrating to get to this point and not to be able to prepopulate the most important field!

Hi all,

 

I am relatively new at this and I have a simple Apex clas in the non-profit version I am trying to deploy.  The class itself has passed with 91% coverage but its inserting a contact and I'm getting low coverage on other classes that I am guessing are getting triggered by the insert.  I'm not sure we need these triggers and I have been wanting to turn them off, but figured I'd wait a while to be sure.  My question is, do I need to build tests in my method for these classes or is there something that needs to be done in the classes themselves?

 

Thanks,

H

I have developed a VisualForce page that renders as PDF and have been able to successfully include stylesheets, images, etc.

Unfortunately if I try to include a background image, it does not get displayed. 

 

I have uploaded the image as a static resource, and reference it in my css as follows:

 

.paid {
background-image: url('paid_img');
}

 

The css file is included as  an apex:stylesheet with value {!$Resource.stylesheet}

 

On the Visualforce page I created a div tag with class "paid", but no luck displaying the image. I also tried to use style="background:image url('{!$Resource.paid_img}')" in my div tag, but no luck either.

 

If I create an apex:image tag with value {!$Resource.paid_img} the image gets displayed, so I really don't know what the problem could be.

 

Any help much appreciated!

 

 

  • January 21, 2010
  • Like
  • 0

How can I get Apex to mimic passing the field data from the visualforce page to the controllerexstension save method. I have looked at 100's of examples yet still cant find a solution.:smileysad:

 

vf:

 

<apex:page standardController="contact" showHeader="false" extensions="appExtension">

<apex:composition template="StdOCEITemplate">
<apex:define name="pagebody">
<apex:form rendered="{!(SelectedEvent.Name != '')}" >
<apex:pageMessages />
<apex:pageBlock title="{!SelectedEvent.Name} - Application Form">
<apex:pageBlockSection title="Main Details" columns="2" >

<apex:inputField value="{!contact.Salutation}" id="title" required="true" />
<apex:outputText >&nbsp;</apex:outputText>
<apex:inputField value="{!contact.FirstName}" id="firstname" required="true" />
<apex:inputField value="{!contact.LastName}" id="lastname" />
<apex:inputField value="{!contact.Email}" id="email" required="true" />

<!-- more vf page here -->

  <apex:pageBlockButtons location="bottom" title="Submit">
<apex:commandButton action="{!save}"
value="Submit New Application"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>

 

controller 

 


public class appExtension {

// Decare Vars from Querystring
Id accountrecordtypeid = ApexPages.currentPage().getParameters().get('AccountRecordTypeID');
Id contactrecordtypeid = ApexPages.currentPage().getParameters().get('ContactTypeID');
Id eventid = ApexPages.currentPage().getParameters().get('eventID');


public appExtension(ApexPages.StandardController controller) {
this.contact =
(Contact)controller.getRecord();
}

 /*More Controller code hear */

//This is the method that will save the details to the database
public PageReference save()
{
//set savepoint at start so as to stop account information being set if applicant has already applied for event.
Savepoint sp = Database.setSavepoint();
// Logic to make sure first letter of name/surname is in upper case
String FirstName = Contact.FirstName;
String LastName = Contact.LastName;
if (FirstName != null && LastName != null && FirstName != '' && LastName != ''){

//test method never gets in here

}

 test method:

 

public static testMethod void testappExtensionBusApp() {
ApexPages.standardController controller = new ApexPages.standardController(new Contact());
// Business applicant test where Business applicant selects an existing account.
ApexPages.currentPage().getParameters().put('AccountRecordTypeID',[Select ID from RecordType Where SobjectType = 'Account' and Name = 'Business Organisation' Limit 1].id);
ApexPages.currentPage().getParameters().put('ContactTypeID',[Select ID from RecordType Where SobjectType = 'Contact' and Name = 'Business Applicant' Limit 1].id);
ApexPages.currentPage().getParameters().put('eventID',[select id from SBS_Event__c Where Display_on_website__c = True and Event_Start_Date__c > Today Limit 1].id);

appExtension busextension = new appExtension(controller);

//select a random existing account to associate with.
busextension.picklistValue = [select name from Account limit 1].id;


// this is a insert because email is new in system
//decalre fields from application form
/* Contact contact = new Contact(
Firstname = 'testier',
Lastname = 'tester',
Email = 'test@test.com');
Attempt 1 does not get into If statment*/


/* busextension = new appExtension(controller);
busextension = Firstname('test.');
busextension = Lastname('testier');
busextension = Email('test@test.com');

Attempt 2 does not complile Method does not exist incorrect signiture */

String nextPage = busextension.save().getUrl();


busextension.save.getURL();
// Verify that the success page displays
System.assertEquals('/events/confirmsave', nextPage);

}
}

 

 

 

 

 

I have a class and a trigger associated with the class... Now, I want to deploy it and I tested it out with a couple of accounts in sandbox where i have the trigger and class... But i keep getting the error Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required... when i try to deploy it from eclipse...
What should I do? How do you test this?