• Shanke_Paudel
  • NEWBIE
  • 0 Points
  • Member since 2013

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

I can i associate a apex class with a apext test class?

 

My class

public class NewContact{

public void getopportunity(){
}
}

 

Test Class

@isTest
public class NewContactTest{
@isTest static void Testgetopportunity() {
}
}

 

in force.ide i do see none with Code coverage tab.

 

 

Regard's

Shanker Paudel

I have an custom page that shows come contacts with inline edit option.

 

I also have another apex:pageBlock 

that contains add new contact fields. the contact can be added successfuly.

 

But the problems are below.

1)If user clicks on any navigation link.. error comes lastname cannot be empty i know it is required.. but what if user do not want to add another contact.

2)I want to show and hide this on user click pageBlock.. i have added Jquery but i am not able to find a suitable selector for ti.

 

Here is the controller.

public class approvestep2companycontact{

public PageReference saveNew() {
newContact.AccountId = opportunity.Account.Id;
insert newContact;

PageReference pageRef = new PageReference(ApexPages.currentPage().getUrl());
pageRef.setRedirect(true);
return pageRef;
}

public PageReference back(){
PageReference oPageRef = Page.ApproveStep1CompanyInfo;
oPageRef .getParameters().put('id',opportunity.id );
oPageRef.setRedirect(false);
return oPageRef;
}

public PageReference save() {
update contacts;
return null;
}
public PageReference approve() {
update contacts;
PageReference oPageRef = Page.ApproveStep2CompanyContact;
oPageRef .getParameters().put('id',opportunity.id );
oPageRef.setRedirect(false);
return oPageRef;
}

public PageReference edit() {
return null;
}

Public List<Contact> contacts {get;set;}
private final Opportunity opportunity;
private final Contact newContact;

public approvestep2companycontact() {
opportunity = [SELECT Id,Account.Id, Name FROM Opportunity WHERE Id = :ApexPages.currentPage().getParameters().get('id') ];
contacts = [SELECT LastName, FirstName FROM contact WHERE AccountId = :opportunity.Account.Id ];
newContact = new Contact();
}

public Contact getNewContact(){
return newContact;
}

public List<Contact> getContacts () {
return contacts ;
}
}

 

Here is the vf page.

<apex:page controller="approvestep2companycontact" >
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
<apex:form >
<apex:pageBlock title="Company Contacts" mode="inlineEdit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" id="saveButton" value="Save"/>
<apex:commandButton action="{!approve}" id="approveButton" value="Approve"/>
<apex:commandButton action="{!back}" id="bcakButton" value="Back"/>
</apex:pageBlockButtons>
<apex:pageMessages />
<apex:pageBlockTable value="{!contacts }" var="item">
<apex:column headerValue="Last Name">
<apex:outputField value="{!item.LastName}"/>
</apex:column>
<apex:column headerValue="First Name">
<apex:outputField value="{!item.FirstName}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Add New Contact" id="pbNewContact">
<apex:pageBlockButtons >
<apex:commandButton action="{!saveNew}" id="saveButton" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{!newContact.Firstname}"/>
<apex:inputField value="{!newContact.Lastname}"/>
<apex:inputField value="{!newContact.Title}"/>
<apex:inputField value="{!newContact.Email}"/>
<apex:inputField value="{!newContact.Fax}"/>
<apex:inputField value="{!newContact.Phone}"/>
<apex:inputField value="{!newContact.OtherPhone}"/>
</apex:pageBlockSection>
</apex:pageBlock>

</apex:form>
<script type="text/javascript">
j$ = jQuery.noConflict();
j$(document).ready(function() {
j$("#j_id0:j_id2:pbNewContact")).hide();
});

</script>
</apex:page>

i am not able to create apex class in the enterprice edition of Salefoce.
http://help.salesforce.com/apex/HTViewSolution?id=000005267&language=en_US

later i discoverd one can create class from Force.com IDE. This did't worked either
Error.
"Can not create Apex Class on an active organization."

After that i came to know about sandbox in saleforce.
but when i try to login there i get this error

"Your login attempt has failed. The username or password may be incorrect, or your location or login time may be restricted. Please contact the administrator at your company for help."

KINDLY HELP ME OUT!

how can i Redirect user on login based on there profile or role..

i heard about siteloginController is it something i can change if yes how..

 

Regard's

Shanker Paudel

My Custom Visualforce page.
<apex:page controller="UnapprovedList">
<apex:pageBlock title="Opportunities">
<apex:pageBlockTable value="{!Opportunity}" var="item">
<apex:column value="{!item.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

My Controller
public class UnapprovedList{
private final Opportunity opportunity;

public UnapprovedList() {
opportunity = [SELECT Id, Name FROM Opportunity limit 1];
// the page displays error if i remove limit 1.
//System.QueryException: List has more than 1 row for assignment to SObject
}

public Opportunity getOpportunity () {
return opportunity;
}
}

where is the problem?? i want to show more than one row but when i return multiple row the error pops up..
Any help would be appricated.

I need to send emails after 7 or 14 days when some event happens for example Account Update.

I need to create a view.. i call it approve view..

 

It has three tabs.

 

One fetch data from lead, // xyz fields.

second from a account converted from that lead, //xyz fields.

third from a opportunity from the above account.

 

I want to pass id of opportunity and view the above information for the opportunity...
is that possible in sales force if yes how??

 

 

 

i am trying this walkthrough in .net

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=calls.htm|StartTopic=Content%2Fcalls.htm|SkinName=webhelp

 

when i add 

using Walkthrough.sforce;

i get this error

using Walkthrough.sforce;

Error 3 The type or namespace name 'sforce' does not exist in the namespace 'Walkthrough' (are you missing an assembly reference?) E:\Shanker\Lab\Walkthrough\Walkthrough\Program.cs 6 19 Walkthrough

 

What could be the posible reason of this error.

code inmy app.config looks like this

 

<Walkthrough.Properties.Settings>
<setting name="Walkthrough_sforce_SforceService" serializeAs="String">
<value>https://login.salesforce.com/services/Soap/c/29.0</value>
</setting>
</Walkthrough.Properties.Settings>
</applicationSettings>

i am trying this walkthrough in .net

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=calls.htm|StartTopic=Content%2Fcalls.htm|SkinName=webhelp

 

when i add 

using Walkthrough.sforce;

i get this error

using Walkthrough.sforce;

Error 3 The type or namespace name 'sforce' does not exist in the namespace 'Walkthrough' (are you missing an assembly reference?) E:\Shanker\Lab\Walkthrough\Walkthrough\Program.cs 6 19 Walkthrough

 

What could be the posible reason of this error.

code inmy app.config looks like this

 

<Walkthrough.Properties.Settings>
<setting name="Walkthrough_sforce_SforceService" serializeAs="String">
<value>https://login.salesforce.com/services/Soap/c/29.0</value>
</setting>
</Walkthrough.Properties.Settings>
</applicationSettings>

I have an inline vf page on a standard detail page with a button beside a field.

During inline edit, if i enter some detail to the standard detail page field and click on the inline vf button before saving, it should throw up an alert saying "Please save the record".

How do I achieve this ? pls help

I need to create a view.. i call it approve view..

 

It has three tabs.

 

One fetch data from lead, // xyz fields.

second from a account converted from that lead, //xyz fields.

third from a opportunity from the above account.

 

I want to pass id of opportunity and view the above information for the opportunity...
is that possible in sales force if yes how??