• aruna11.3081223889641084E12
  • NEWBIE
  • 125 Points
  • Member since 2011

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 25
    Replies

Hi, 

 

How to use the apex sharing settings.  I saw the code for apex sharing settings in

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_bulk_sharing_creating_with_apex.htm

 

i use this code i got the error as

 

Error: Compile Error: sObject type 'job__share' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 90 column 32

 

How can i create job_share. Any one please help me for solving this. 

 

Thanks,

Lakshmi.


I am trying to write a test class for the trigger below as follows,

//Trigger on "enrollpeople" object which allows the field "Booked slots" to be incremented as the "EnrollPeople"is added and also verifying that "Booked slots" should not be greater than "Totalslots" //



trigger enrollcandidatetrigger on Enroll_Candidate__c(after delete, after insert, after update,after undelete)
{

Enroll_Candidate__c[] coursedetails;
if(Trigger.IsDelete)
coursedetails=Trigger.old;

else
coursedetails=Trigger.new;

Set<ID> CourseId= new set<ID>();

for(Enroll_Candidate__c candidates:coursedetails)
{
CourseId.add(candidates.Course_Details__c);
}

Map<ID,Course_Details__c> coursedetailsforcandidates=new Map<ID,Course_Details__c>([Select Id, Booked_Slots__c, Total_Slots__c, (Select Id from Enroll_Candidates__r ) from Course_Details__c where Id in:CourseId]);
for(Enroll_Candidate__c candidates:coursedetails)
{

Course_Details__c coursess = new Course_Details__c();
coursess = coursedetailsforcandidates.get(candidates.Course_Details__c);


if(coursess.Total_Slots__c >= coursess .Enroll_Candidates__r .size())
      coursess.Booked_Slots__c=coursess .Enroll_Candidates__r .size();
else
        candidates.addError('Booked seats should not exceed Total seats');
}


update coursedetailsforcandidates.values();
}

i have also written the test class as'
@isTest
public class EnrollCandidateTests
 {
 static testMethod void test()
 {

Enroll_Candidate__c ec = new Enroll_Candidate__c(Name ='Test');

insert ec;
}
}
but i am getting an error message "
  
ErrorError: Compile Error: Field is not writeable: Enroll_Candidate__c.Name at line 7 column 55
"because no such field exists also the object has only lookup relationship with other objects, could you plese help m e out with this issue





hi friends,

i have created a object named as Job,

i want to assign roles(different different users) for particular job record .

is it possible??

give me some idea about userrole... and how to user vf and apex in case of userrole?

Hi,

 

I am facing the problem in below scenario:

 

I have created 1 visualforce page, which used extension controller.

I want to input some values in the page and on clicking button, new window should be opened as a popup which in which i will put some more data and will ckick on save button in popup window page.

Both the pages will use same extension controller.

But the problem is, if i enter the data on new window page, and click save, that inputfield is giving me null value.

 

Please find below my simple code:

Page 1:

AccountPage:

 

<apex:page standardController="Account" extensions="AccountExtController">
    <apex:form >
        <apex:pageblock title="Date Section">
            <apex:pageBlockButtons >                                
                <apex:commandLink action="{!doAction}" value="SaveLink" id="theLink" target="_new">   
                    <apex:param name="accId" value="{!account.Id}"/>
                </apex:commandLink>               
            </apex:pageBlockButtons>
            <apex:inputField value="{!account.OppCloseDate__c}"/>
            </apex:pageblock>
    </apex:form>
</apex:page>

 

Second page: NewWindowPage

 

<apex:page standardController="Account" extensions="AccountExtController" sidebar="false" showHeader="false">
<script>
function closeWindow(){
    alert('closing window...');
    //window.close();       
}
</script>

<apex:form >
    <apex:pageBlock title="My Content">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!updateAccountAndCreateOpp}" value="Save Records" onclick="return closeWindow();" immediate="true"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Select NBK ID" columns="2">
                <apex:inputField value="{!account.NBKID__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
</apex:form>
</apex:page>

 

Extension controller:

 

public class AccountExtController {
    Account acc{get; set;}
    String accCloseDate='';
    public AccountExtController(ApexPages.StandardController controller) {
        System.debug('inside constructor...');
        acc = (Account)controller.getRecord();
    }
   
    public Pagereference doAction(){
        System.debug('inside doAction...');
        String aid = Apexpages.CurrentPage().getParameters().get('accId');
        System.debug('aid: '+aid);

        System.debug('account opp close date: '+acc.OppCloseDate__c);
        accCloseDate = ''+acc.OppCloseDate__c;
        

        Pagereference ref = Page.NewWindowPage;  
        ref.getParameters().put('id',acc.Id);
        ref.setRedirect(false);
        return ref;   
    }

 

    public Pagereference updateAccountAndCreateOpp(){
        Id secondpageId = ApexPages.currentPage().getParameters().get('id');
        System.debug('#### accCloseDate: '+accCloseDate);    

        System.debug('#### acc: '+acc);
        System.debug('#### acc.NBKID__c: '+acc.NBKID__c);
        return null;
    }
}

 

 

The above method "updateAccountAndCreateOpp" is called from second VF page in which i have set debug statements.I n this method, i am able to retain first page data as i have set redirect to false, for second page.

But i am not able to get the data in inputfield on second page.Its coming null.

 

Please suggest how to associate data on second page?

 

Thanks in advance.


 

Hi,

 

I have below requirement.

 

I have displayed list with checkboxes on one Visualforce page.

Selecting some records, i have to click the "Accept" button which will open new visualforce page in new window on top of existing window.

On this page, user will select value from picklist, and will update all the selected records from the parent page with this selected picklist value.

Now, I have to use same controller for both the pages as data should be available there which is selected from the two pages(checkboxex from one page and picklist value from new window visualforce page).

 

If i select picklist value , as it is new page , its controller(Constructor) will be called again which will erase my previosly selected records from first VF.

 

Please suggest solution for this.

 

Thanks in advance.

Hi,

 

I need to display a visualforce page containing all input fields for email purpose.

likeTO,CC,BCC

Email body and some buttons, just like outlook window functionality.

 

In email body, i have to use spell checker component and text format component as we use in outlook.

Or just like writing a message on discussion boards, we are getting this window which allows us to use Rich text,html or preview format.It also allows us to check the spelling using "Spell check".

Is this possible in visualforce page?

 

Does anybody know, how it can be achieved?

Does active  object provide those features?

 

Your help will be highly appreciated.

 

 

Hi,

 

I need to open a visualforce page from the formula link...

So, in hyperlink function i have set the url for opeing that VF page.

Just the simple hyperlink formula:

 

HYPERLINK("/apex/TestPage", Email)

 

Now, i want t open this "Testpage" in new window with fixed height and width.

 

From standard config  setting for the detail page button, i am able to provide height and width for the new window.

But how to provide height and width through this formula field?

 

Please help!!

 

Hi,

 

As per the requirement, i have to send email from Visualforce page through outlook client.

So, on Visualforce page, in a javascript code, i am invoking Outlook client and composing the email.

Email  will be displayed to the user in outlook window and before sending it, user can modify the data.

But i need to pass some hidden content to that email like contact ids which i cannot pass in emial body as user may delete it.

 

Please find below the code script and suggest how to pass hidden in email while sending email through outlook client. 

 

var outlookApp = new ActiveXObject("Outlook.Application");

var nameSpace = outlookApp.getNameSpace("MAPI");

var mailFolder = nameSpace.getDefaultFolder(6);

var mailItem = mailFolder.Items.add('IPM.Note.FormA');

mailItem.Subject= emailSubjectArray[0];

mailItem HTMLBody = bodyString;

mailItem.Bcc = bccArrayString;

Display(0);

 

Is there any method available in MAPI which will allow me to set hidden data along with email header ???

 

 

Your help will be greatly appreciated.!!

 

Thanks,

Aruna

 

 

 

Hi,

Please find below the scenario.

I have to work with dynamic SOQL. Because i may need to select diffent fields from the object at runtime.

So, consider,

String fieldString = 'name, id, email';

List<String> FieldList = new List<String();

fieldList.add('Name');

fieldList.add('Id');

fieldList.add('Email');

 

List<Contact> cList  = Database.Query('Select '+fieldString +'From Contact limit 10');

As my fieldString contains 3 fields, i will have to form 3 maps in the below for loop.

If String contains 4 fields, i will have to create 4 maps accordingly.

 

//Creating dymnamic maps here according to the number of fields in fieldList.

for(integer i = 0; i< fieldList.size();i++){

         Map<String,String> map+fieldList[i] = New Map<String,String>();

         // i need something like this..so that i will have 3 maps here with the different map names.

         But dynamic creatiion of variable name is not possible here in: map+fieldList[i]  (to form map names like: mapName, mapId, mapEmail dynamically...);

  

}

 

So, is there any way to name the variables dynamically in Apex?

Thanks in advance for any help...!!!

Hi,

 

I have fetched HtmlValue from EmailTemplate. This is returned as String. This String contains all HTML code so, contains many (")characters. I need to replace (") character from this string with (\") so that i should return this string in javascript code on VF.

 

I tried with str.replaceAll('"','\"');

and str.replaceAll('\"','\\"');

 

 

'The source string is: Str= '<table height="400" width="600" cellpadding="5" border="0" cellspacing="5" >
<br/><tr height="50" valign="top" >
<br/><td style=" color:#000000; font-size:12pt; background-color:#CCCCFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r1" locked="0" aEditID="c1r1" >
<br/>Dear {!Contact.LastName}</td>
<br/></tr>
<br/><tr height="300" valign="top" >
<br/><td style=" color:#000000; font-size:12pt; background-color:#CCCCFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r2" locked="0" aEditID="c1r2" >
<br/><P>Your conact id is: {!Contact.Id}</P></td>
<br/></tr>
<br/><tr height="50" valign="top" >
<br/><td style=" color:#000000; font-size:12pt; background-color:#CCCCFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r3" locked="0" aEditID="c1r3" >
<br/><P>Thanks,</P>
<br/><P>SFDC Dev Team</P></td>
<br/></tr>
<br/></table>;

Dont know if this is the problem with escape sequences?

Your help is appreciated...

Hi,

 

I have below requirement.

 

I have displayed list with checkboxes on one Visualforce page.

Selecting some records, i have to click the "Accept" button which will open new visualforce page in new window on top of existing window.

On this page, user will select value from picklist, and will update all the selected records from the parent page with this selected picklist value.

Now, I have to use same controller for both the pages as data should be available there which is selected from the two pages(checkboxex from one page and picklist value from new window visualforce page).

 

If i select picklist value , as it is new page , its controller(Constructor) will be called again which will erase my previosly selected records from first VF.

 

Please suggest solution for this.

 

Thanks in advance.

Hi, 

 

How to use the apex sharing settings.  I saw the code for apex sharing settings in

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_bulk_sharing_creating_with_apex.htm

 

i use this code i got the error as

 

Error: Compile Error: sObject type 'job__share' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 90 column 32

 

How can i create job_share. Any one please help me for solving this. 

 

Thanks,

Lakshmi.


I am trying to write a test class for the trigger below as follows,

//Trigger on "enrollpeople" object which allows the field "Booked slots" to be incremented as the "EnrollPeople"is added and also verifying that "Booked slots" should not be greater than "Totalslots" //



trigger enrollcandidatetrigger on Enroll_Candidate__c(after delete, after insert, after update,after undelete)
{

Enroll_Candidate__c[] coursedetails;
if(Trigger.IsDelete)
coursedetails=Trigger.old;

else
coursedetails=Trigger.new;

Set<ID> CourseId= new set<ID>();

for(Enroll_Candidate__c candidates:coursedetails)
{
CourseId.add(candidates.Course_Details__c);
}

Map<ID,Course_Details__c> coursedetailsforcandidates=new Map<ID,Course_Details__c>([Select Id, Booked_Slots__c, Total_Slots__c, (Select Id from Enroll_Candidates__r ) from Course_Details__c where Id in:CourseId]);
for(Enroll_Candidate__c candidates:coursedetails)
{

Course_Details__c coursess = new Course_Details__c();
coursess = coursedetailsforcandidates.get(candidates.Course_Details__c);


if(coursess.Total_Slots__c >= coursess .Enroll_Candidates__r .size())
      coursess.Booked_Slots__c=coursess .Enroll_Candidates__r .size();
else
        candidates.addError('Booked seats should not exceed Total seats');
}


update coursedetailsforcandidates.values();
}

i have also written the test class as'
@isTest
public class EnrollCandidateTests
 {
 static testMethod void test()
 {

Enroll_Candidate__c ec = new Enroll_Candidate__c(Name ='Test');

insert ec;
}
}
but i am getting an error message "
  
ErrorError: Compile Error: Field is not writeable: Enroll_Candidate__c.Name at line 7 column 55
"because no such field exists also the object has only lookup relationship with other objects, could you plese help m e out with this issue





Hi,

 

I need to open a visualforce page from the formula link...

So, in hyperlink function i have set the url for opeing that VF page.

Just the simple hyperlink formula:

 

HYPERLINK("/apex/TestPage", Email)

 

Now, i want t open this "Testpage" in new window with fixed height and width.

 

From standard config  setting for the detail page button, i am able to provide height and width for the new window.

But how to provide height and width through this formula field?

 

Please help!!

 

Is there a way to access schema of list view in apex class. If so please explain. If not , can you suggest me the alternatives

 

Hi,

I have to implement a salesforce to SMS function where user will be able to send an sms from salesforce to client. I am facing a bit of challenge in constructing the URL with parameters in it, that is sent to the SMS service. The SMS text is formatted in a sense that it ends with the Sender Name, Mobile and Company Name e.g:

 

_____________________

This is the test SMS Text

 

Sender Name

Mobile Phone

Company

____________________

 

 

The problem is in the characters used for formatting the text \n and \r.  Below is the code:

 

public PageReference sendSMS(){
		
		
		User u = [select FirstName, LastName, MobilePhone from User where Username =: UserInfo.getUserName()];
		
		SMS__c sms = [select SMS_Text__c, Account__c from SMS__c
		where id = :ApexPages.currentPage().getParameters().get('id')];
		
		Account acc = [Select Phone from Account where Id = :sms.Account__c];
		 
		String smstext = sms.SMS_Text__c+'\n\n'+u.FirstName+' '+u.LastName+'\n'+u.MobilePhone+'\nCyber Consultants';
		//sms.SMS_Text__c = smstext;
		//insert sms;
		String myurl = 'http://mytestcompany.com/sendurlcomma.asp?user=200335466&pwd=jn23e52&senderid=ABC&mobileno='+acc.Phone+'&msgtext='+smstext+'&priority=High&CountryCode=+971';

		
		PageReference mypage = new PageReference(myurl);
	    mypage.setRedirect(true);
	    return myPage;
	}

 Pleas if anyone can lead me to the right direction in generating the proper URL.

 

Hi,

 

As per the requirement, i have to send email from Visualforce page through outlook client.

So, on Visualforce page, in a javascript code, i am invoking Outlook client and composing the email.

Email  will be displayed to the user in outlook window and before sending it, user can modify the data.

But i need to pass some hidden content to that email like contact ids which i cannot pass in emial body as user may delete it.

 

Please find below the code script and suggest how to pass hidden in email while sending email through outlook client. 

 

var outlookApp = new ActiveXObject("Outlook.Application");

var nameSpace = outlookApp.getNameSpace("MAPI");

var mailFolder = nameSpace.getDefaultFolder(6);

var mailItem = mailFolder.Items.add('IPM.Note.FormA');

mailItem.Subject= emailSubjectArray[0];

mailItem HTMLBody = bodyString;

mailItem.Bcc = bccArrayString;

Display(0);

 

Is there any method available in MAPI which will allow me to set hidden data along with email header ???

 

 

Your help will be greatly appreciated.!!

 

Thanks,

Aruna

 

 

 

hi friends,

i have created a object named as Job,

i want to assign roles(different different users) for particular job record .

is it possible??

give me some idea about userrole... and how to user vf and apex in case of userrole?

Hi,

Please find below the scenario.

I have to work with dynamic SOQL. Because i may need to select diffent fields from the object at runtime.

So, consider,

String fieldString = 'name, id, email';

List<String> FieldList = new List<String();

fieldList.add('Name');

fieldList.add('Id');

fieldList.add('Email');

 

List<Contact> cList  = Database.Query('Select '+fieldString +'From Contact limit 10');

As my fieldString contains 3 fields, i will have to form 3 maps in the below for loop.

If String contains 4 fields, i will have to create 4 maps accordingly.

 

//Creating dymnamic maps here according to the number of fields in fieldList.

for(integer i = 0; i< fieldList.size();i++){

         Map<String,String> map+fieldList[i] = New Map<String,String>();

         // i need something like this..so that i will have 3 maps here with the different map names.

         But dynamic creatiion of variable name is not possible here in: map+fieldList[i]  (to form map names like: mapName, mapId, mapEmail dynamically...);

  

}

 

So, is there any way to name the variables dynamically in Apex?

Thanks in advance for any help...!!!

Hi,

 

I have fetched HtmlValue from EmailTemplate. This is returned as String. This String contains all HTML code so, contains many (")characters. I need to replace (") character from this string with (\") so that i should return this string in javascript code on VF.

 

I tried with str.replaceAll('"','\"');

and str.replaceAll('\"','\\"');

 

 

'The source string is: Str= '<table height="400" width="600" cellpadding="5" border="0" cellspacing="5" >
<br/><tr height="50" valign="top" >
<br/><td style=" color:#000000; font-size:12pt; background-color:#CCCCFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r1" locked="0" aEditID="c1r1" >
<br/>Dear {!Contact.LastName}</td>
<br/></tr>
<br/><tr height="300" valign="top" >
<br/><td style=" color:#000000; font-size:12pt; background-color:#CCCCFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r2" locked="0" aEditID="c1r2" >
<br/><P>Your conact id is: {!Contact.Id}</P></td>
<br/></tr>
<br/><tr height="50" valign="top" >
<br/><td style=" color:#000000; font-size:12pt; background-color:#CCCCFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r3" locked="0" aEditID="c1r3" >
<br/><P>Thanks,</P>
<br/><P>SFDC Dev Team</P></td>
<br/></tr>
<br/></table>;

Dont know if this is the problem with escape sequences?

Your help is appreciated...