• jhansisridhar_2011
  • NEWBIE
  • 144 Points
  • Member since 2012

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 38
    Replies

Hi,This is Swamy...

                                        

                                        I want something details about   ""WEB API"".....

 

Plz reply me ....ASAP.

 

  • May 28, 2012
  • Like
  • 0

Hello,

 

I'm having issues trying to figure out how to delete a Managed custom report type. I deleted the app but the report type is still there and it doesn't have a delete button next to it, just edit. How would I delete it?

 

Thank You

  • April 30, 2012
  • Like
  • 0

trigger users on User (before insert, before update) {

    if(Test.isrunningtest()) {
        system.debug('Allowing user create/edit.');
    } else {
        List<User> oUser = [SELECT Id, Security_user__c, ProfileId, UserName FROM User WHERE Id = :System.UserInfo.getUserId() LIMIT 1];
        If(oUser[0].UserName.endsWith('.dev10')){
          
            system.debug('IS DEV USER: Allowing user create/edit.');
        } else {
            Boolean isSecurityUser = oUser[0].Security_user__c;
            if(isSecurityUser) {
              
             
            } else {
                if(Trigger.isUpdate) {
                    List<Profile> list_pAdmin = [SELECT Id FROM Profile WHERE Name IN ('System Administrator','SL: System Administrator','SL: Sys Admin ','SL: Read Only Admin','SL: Read Only Admin Non ') LIMIT 5];
                    Set<String> set_pAdmin = new Set<String>();
                    for(Profile pAdmin : list_pAdmin) {
                        set_pAdmin.add(pAdmin.Id);
                    }
                    for(User oUserRec : Trigger.New) {
                        if((oUserRec.Id == System.UserInfo.getUserId()) && (!set_pAdmin.contains(oUser[0].ProfileId))) {
                            system.debug('IS THE USERS OWN RECORD AND THEY ARE NOT A SYS ADMIN: Allowing user create/edit.');
                        } else {
                            system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                            oUserRec .addError('You do not have permission to create or edit user records!');
                        }
                    }
                } else {
                    for(User oUserRec : Trigger.New) {
                        system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                        oUserRec .addError('You do not have permission to create or edit user records!');
                    }
                }
            }
        }
    }

}

Hi All,

 

I need help in google Maps.

I have a app , to display multiple pinpoints, wherever sales person present with thier longitute and latitude.

Below is my code snippet:

<apex:page standardController="xyz__c" extensions="xyz_gmaps" action="{!value}">



<script src="/soap/ajax/23.0/connection.js" type="text/javascript"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=true&libraries=places" type="text/javascript"></script>
<script  type="text/javascript">
 

function initPage(){
    if (navigator.geolocation)
        {
            navigator.geolocation.getCurrentPosition(
         
            function (position) {  
    
            mapThisGoogle(position);
     
            },
           
       
            );
        }
        
    }

function mapThisGoogle(position)
{
    <!-- In position we will get i-pod location of Sales Rep  -->
    var mapCenter = new GLatLng(position.coords.latitude,position.coords.longitude);
    <!-- we can get latitude and longitude of Sales Rep position and save when status is completed -->
    alert(position.coords.latitude+'gmap'+position.coords.longitude);
    var geocoder = new GClientGeocoder();        
    map = new GMap2(document.getElementById("j_id0:j_id2:j_id3:map_canvas"));
    map.setCenter(mapCenter, 13);  
    map.addOverlay(new GMarker(mapCenter));
     
    <!-- This is for physician visit location address dynamically from contact in which if their is mailing address means it will display else other address will display -->
        geocoder.getLatLng("Akota rd,vadodara", function(point) {
       if (!point) {
            alert(place + " not found");
        } else {
        
         <!--add Zoom Control, Map Type control -->
            map.addControl(new GSmallZoomControl());
            map.addControl(new GScaleControl());
            
            <!--add custome Blue Marker -->
            var newIcon = MapIconMaker.createMarkerIcon({width: 20, height: 34, primaryColor: "#0000FF", cornercolor:"#0000FF"});
            var marker = new GMarker(point, {icon: newIcon});
         
            map.addOverlay(marker);
            alert(point.y +' map1'+ point.x);
            }
            <!--  Here code for distance calculation --->
            var radlat1 = Math.PI * position.coords.latitude/180; <!---- Here  Math.PI = 3.141592653589793 -->
            var radlat2 = Math.PI * point.y/180;
            var radlon1 = Math.PI * position.coords.longitude/180;
            var radlon2 = Math.PI *  point.x/180;
            var theta =  position.coords.longitude- point.x;
            var radtheta = Math.PI * theta/180;
            var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
            dist = Math.acos(dist);
            dist = dist * 180/Math.PI;
            dist = dist * 60 * 1.1515;
            dist = dist * 1.609344;
            
            alert(dist);
       })
         
}
window.onload = initPage;

</script>   
  <c:GoogleMapsInternational iconColour="#BF8C9F"
      address="{!Street},{!City},{!state},{!country} "/>
   
</apex:page>

 

am able to run gmaps with place, but I could not able to disply 2 pinpoint in gmaps, Is anything missing in coding .Could any one help me .

 

Advance Thanks.

How to get satisfy the if condition so which not able to cover

 

XmlStreamReader r = new XmlStreamReader(xmlInput);


if ('Product' == r.getLocalName()) {

.

.

.

}

 

Thanks in Advance.

Hi All, Help me to write a test class for below code,

public void storeProducts(){

XmlStreamWriter w = new XmlStreamWriter();

w.writeStartElement(null, 'Product', null);

w.writeStartElement(null, 'Id', null);

w.writeCharacters(p.Id);

w.writeEndElement();

...............

..................

............................

}

Test class: I have written test class as,

 

static TestMethod void storeProducts (){

XmlstreamWriter demo = new XmlstreamWriter();
          string result=demo.getXmlstring();
          string expected='<?xml version="1.0"?><?Products?>' + '<m:Product>' + '<00190000009rvgY>'; // is any other way to represent this line//
        System.assert(result == expected);

}

 

Failure: System.AssertException: Assertion Failed.


Thanks in Advance.

Hi All,

 

Help me to write a test class for below code,

 

public void storeProducts(){


XmlStreamWriter w = new XmlStreamWriter();


        w.writeStartElement(null, 'Product', null);
         w.writeStartElement(null, 'Id', null);
         w.writeCharacters(p.Id);
         w.writeEndElement();

              ...............

           ..................

             .............................

}

 

Test class: I have written test class as,

 

static TestMethod void storeProducts (){

XmlstreamWriter demo = new XmlstreamWriter();
          string result=demo.getXmlstring();
          string expected='<?xml version="1.0"?><?Products?>' + '<m:Product>' + '<00190000009rvgY>'; // is any other way to represent this line//
        System.assert(result == expected);

}

 

Failure: System.AssertException: Assertion Failed


 

Thanks in Advance.

Hi All,

 

Help me to write a test class for below code,

 

public void storeProducts(){


XmlStreamWriter w = new XmlStreamWriter();


        w.writeStartElement(null, 'Product', null);
         w.writeStartElement(null, 'Id', null);
         w.writeCharacters(p.Id);
         w.writeEndElement();

              ...............

           ..................

             .............................

}

 

Test class: I have written test class as,

 

static TestMethod void storeProducts (){

XmlstreamWriter demo = new XmlstreamWriter();
          string result=demo.getXmlstring();
          string expected='<?xml version="1.0"?><?Products?>' + '<m:Product>' + '<00190000009rvgY>'; // is any other way to represent this line//
        System.assert(result == expected);

}

 

Failure: System.AssertException: Assertion Failed

 

Thanks in Advance.

Hi all,

 

Please help me to increase code coverage in test class, I have written a apexclass,

 
 public void storeProductsTxt(){
        System.debug('********** Store Products in XML **********');        
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
        w.writeStartElement(null, 'Products', null);
        
        String output = '';
        
        for (Product2 p : [Select p.Description, p.Family, p.Id, p.IsActive, p.Name, p.PS_Product_SKU__c, p.Strategic_Value__c, p.Unit_of_Measure__c, 
            p.Maximum_Order_Qty__c, p.Multiple_Order_Qty__c, 
            (Select Name, Quantity_in_Stock__c, Ship_From__c From Inventory__r) 
            from Product2 p where isActive = true limit 10]){
                
            output = '<Product><Id>' + p.Id + '</Id><Name>' + p.Name + '</Name><Description>' + p.Description + '</Description><PSProductSKU>' + p.PS_Product_SKU__c + '</PS Product SKU><UOM>' + p.Unit_of_Measure__c + '</UOM><MAX>' + String.valueOf(p.Maximum_Order_Qty__c) + '</MAX><Multiple>' + String.valueOf(p.Multiple_Order_Qty__c) + '</Multiple><Inventories>';
            
            for (Inventory__c inv : p.Inventory__r){
                output += '<Inventory><WH>' + inv.Ship_From__c + '</WH><Stock>' + String.valueOf(inv.Quantity_In_Stock__c) + '</Stock></Inventory>';    
            }
            
            output += '</Inventories></Product>';
            
            w.writeCData(output);
            
            //System.debug('p: ' + p);
            //output = p + '\n';
            //b = Blob.valueOf(output); 
            
        }
        w.writeEndElement();
        w.writeEndDocument();
        
        String xmlOutput = w.getXmlString();
        System.debug('*** XML: ' + xmlOutput);
        w.close();
        //System.debug('--> output: ' + output);
        
        //Blob b = Blob.valueof(xmlOutput);
        Blob b = Blob.valueof('text');
        
        List<Attachment> list_attachments = [Select Body from Attachment where Name = 'ProductInfo.xml' and ParentId = '001T000000F7raXIAR' limit 1000];
        if (list_attachments.size() > 0){
            delete list_attachments;
        }
        
        Attachment a = new Attachment(); 
        a.Name = 'ProductInfo.xml';
        a.Body = b;
        a.ParentId = '001T000000F7raXIAR';
        a.ContentType = 'text/xml';
        a.IsPrivate = false;
        insert a;
        
    }
getting error message as invalid cross reference id .

Thanks in advance.

Hi All,

 

It's Very urgent !!

Can anyone help to write a test class for below code.

 

Need to satisfy if condition.I created 2 records of an object with Akreos_MIL__c = 220 and Akreos_MIL__c = 210. but, it;s not working to increase code coverage.

 

if (trigger.OldMap.get(pv.Id).Akreos_MIL__c != pv.Akreos_MIL__c) {

.....

...

....

 

}

 

Thanks in Advance.

Hi All,

 

It's Very urgent !!

Can anyone help to write a test class for below code.

 

Need to satisfy if condition.I created 2 records of an object with Akreos_MIL__c = 220 and Akreos_MIL__c = 210. but, it;s not working increase code coverage.

 

if (trigger.OldMap.get(pv.Id).Akreos_MIL__c != pv.Akreos_MIL__c) {

.....

...

....

 

}

 

Thanks in Advance.

Hi All,

 

It's Very urgent !!

Can anyone help to write a test class for below code;

 

Need to satisfy if condition.I created 2 records of an object with Akreos_MIL__c = 220 and Akreos_MIL__c = 210. but, it;s not working increase code coverage.

 

if (trigger.OldMap.get(pv.Id).Akreos_MIL__c != pv.Akreos_MIL__c) {

.....

...

....

 

}

 

Thanks in Advance.

This is getting pretty thick on my end.  But here goes:

 I have an org that allows multiple partner portal users.  Some are executive level, some are manager level.  I want to allow the visual force page to display opportunity records based on the user log in.  I cannot figure out how to connect them in my SOQL statement.   I have pasted in the applicable code, and when I run it on my end (with some fiddling, I can get the records to display based on the user ID, BUT, if a different user from the same company logs in, they cannot see the records that they should be able to since the Owner ID is tied to someone else.

How do i connect them?  Is there some field I can add to an opportunity to make it easier (well, not easier, then i would have to change ALL my opportunity records).

 

Visualforce Page:VF PAGE:
<apex:pageBlock >
    <apex:tabPanel id="theTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" switchType="server" width="100%">
        <apex:tab label="Opportunity" labelWidth="250px" >                                      
            <apex:pageBlockSection id="zero30" title="0-30 Days Opportunity" columns="1">
                <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="red1,red2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>      
            </apex:pageBlockSection>
            <apex:pageBlockSection title="31-60 Days Opportunity" columns="1">
               <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="yellow1,yellow2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="61 Days (or more) Opportunity" columns="1">
                <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="green1,green2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>
            </apex:pageBlockSection>     
        </apex:tab>
    </apex:tabPanel>
</apex:pageBlock>

CLASS:
public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    }   
    public Opportunity[]getRecordDetail(){
        Opportunity[]recordList;
        recordList = [SELECT Opportunity.Opportunity_Name,
                             Opportunity.Opportunity_Owner,
                             Opportunity.Amount,
                             Opportunity.Close_Date
                        FROM Opportunity
                       WHERE OwnerId= :UserInfo.getUserID()];
        return recordList;
    }
}

 

 

 

 

 

Thank you in advance for looking and helping.

Is there any way in which I can fetch a single record by specifying the primary key?

Thank you.

 

~VK

Hi,

 

I have requirement that in javascript inside if condition i want to compare two date field and i am compairing this dates for that i am using below codes

 

var created='{!student__c.CreatedDate}';
if(created>'01/06/2012')
{
alert('All data is already present here');
}
else
{
window.open('http://www.google.co.in');
}

 

But its not working so how i can resolve this issue.

 

Thanks :))))

Hi All,

I have two triggers for two different Objects

trigger AirlineConfAirlineUrlTrigger on Airline_Conf__c (before insert, before update) {
  for(Airline_Conf__c ac : Trigger.New)
    {
      ac.Airlines_Url__c = '';
        if(ac.Airline__c =='Virgin Australia')
        {
            ac.Airlines_Url__c = '<a href="http://www.virginaustralia.com/Personal/Bookings/Managebookings/index.htm">Virgin Australia</a>';
        }
    }
}

trigger ETicketAirlineUrlTrigger on E_Ticket__c (before insert, before update) {
    for(E_Ticket__c etNew : Trigger.New)
    {
      etNew.Airlines_Url__c = '';
        if(etNew.Airline__c =='Virgin Australia')
        {
            etNew.Airlines_Url__c = '<a href="http://www.virginaustralia.com/Personal/Bookings/Managebookings/index.htm">Virgin  Australia</a>';
        }
    }
}

both above triggers does same thing but on different Objects.

I need above trigger to use a component (if possible) or someting , so for any future changes , i only have to change it in one place and so it will refelect in both triggers

Any help would be appreciated

Thanks

Hi,

      I have felds like  College/University, Year Granted, Degree Granted, Major and  College/University1, 

Year Granted1, Degree Granted1, Major1 and  College/University2, Year Granted2, Degree Granted2, Major2

 

and i have wrote a code like this

 

<apex:pageBlockTable value="{!con}"  rows="3" columns="4" var="cc">
     <apex:column > <apex:facet name="header">College/University</apex:facet> <apex:inputfield value="{!cc.College_University__c}"/></apex:column>
     <Apex:column > <apex:facet name="header">Year Granted</apex:facet> <apex:inputfield value="{!cc.Year_Granted__c}"/></apex:column>
     <Apex:column > <apex:facet name="header">Degree Granted</apex:facet> <apex:inputfield value="{!cc.Degree_Granted__c}"/></apex:column>
     <Apex:column > <apex:facet name="header">Major </apex:facet> <apex:inputfield value="{!cc.Major__c}"/></apex:column>
  </apex:pageBlockTable>

 

My problem is ineed to bind the manually entered row values to these field values, how can i do that anyone suggest me.

what is the test code for this class with list ?

 

public class A_List
{
public void s()
{
List<Integer> myList = new List<Integer>();
Integer a;
myList.add(a);
Integer myNumber = myList.get(0);
}
}

Hey Guys,

 

For those new to the platform and eager to start cutting code, I've written a blog post explaining some of the pre-requisites, hope some folks find it useful.

 

 

Hi Frnds,

 

I just want to know about mini page layout and how to create a mini page layout?could you please anyone help me in this....

 

Thanks in advance...

Hi,This is Swamy...

                                        

                                        I want something details about   ""WEB API"".....

 

Plz reply me ....ASAP.

 

  • May 28, 2012
  • Like
  • 0

Hi friends i have deployed one trigger earlier in production with it's test class ...on that time it has 96% test coverage.....after a few days when i am runing test for this test class in production it showing 0% coverage(also trigger name is not coming for testing)....eventhough trigger is achiving it's target and functionality(trigger is activated)....why it's happening please let me know as soon as possible because of it i am not able to deploy some more classes and triggers......thanks

Hi All

 

Can someone offer a definition for a Standard User and and Light User for Database.com ?

 

Thank you.

 

  • May 18, 2012
  • Like
  • 0
 

Hi,


Please tell me how many controller and controller extension can be created in one visualforce page.
And what is component in visualforce page it is similar to the custom component.
Regards
Siddhartha

Hello everyone,

 

 

In our role hierarchy organization we have three different teams. Now I want to have three reports to see accounts of each one of those teams.

 

People change from one team to another very frequently so filter using owner alias is not an option...

 

 

Thanks in advance

I'm unable to install eclipse and not able to figure out what's wrong. Im getting the following error. Please help.........

 

An error occurred while collecting items to be installed
session context was:(profile=SDKProfile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect, operand=, action=).
Problems downloading artifact: osgi.bundle,com.salesforce.ide.api,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 7251ab037ae632a5a9835c7c07210451 and found 88633bfcd6f5878be71182c6a405b2a5.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.core,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 44db36699ca7fdd38917fced4e63c3b3 and found 34334ff579d59c72913cbd9928b55e6a.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.documentation,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 6d87eb2e76e7e19f7b709682e5272dfc and found d2a6ba2eb32dc8029d97a959c8acf4c6.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.ui.editors,24.0.0.201202291629.
MD5 hash is not as expected. Expected: ff45a840737d9bef14347ce6f5b5daa4 and found 32e9df69f5309f6f78ae29e9ce77deb4.

Hi

 

I am new to cloud programming, i want to know how to genarate a reports from apex code, explain with an small example.

 

Regards 

Hi,

Is is possible to opportunities field ( Opportunity name, Opportunity Amount, Opportunity owner, Opportunity status, closed date) in Import wizards field.

Any help would be much appreciated.

Cheers
Uma

  • May 02, 2012
  • Like
  • 0