• Harika Zilla
  • NEWBIE
  • 30 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies

Hi,

 

Iam trying to create an article from Apex code and when i try to assign a value to "SourceId" field,iam getting the following error:

 

"Unable to create/Update fields: SourceId".

 

I did not find any field level security settings for "SourceId" field in my profile.

Can anyone help me how can i set the value to "SourceId" field for articles.

It is very urgent.

 

Thank you,

Harika.

Hi,

 

I have visualforce page with command link.when i click on the link,internally a webservice call happens,which returns HTML code to the controller in the form of string.can anyone provide solution to include that HTML code in visualforce page.

 

VisualForce Page:

 

<apex:page controller="testsearch">
<apex:form >
<apex:commandLink value="Click Me" action="{!testsearch1}">
<apex:param value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=3" assignTo="{!QueryString}"/>
</apex:commandLink>
</apex:form>
{!htmlcode}
</apex:page>

 

Controller Code:

 

public with sharing class testsearch {
public string QueryString{get;set;}
public String htmlcode{get;set;}
public PageReference testsearch1()
{
        Cqservice.CQOperationsPort cqreq=new Cqservice.CQOperationsPort();
        CqserviceCqop.entity_element[] entity=new CqserviceCqop.entity_element[5];
        CqserviceCqop.entity_element entityelement1=new CqserviceCqop.entity_element();
        entityelement1.entityName='QueryString';
        entityelement1.entityValue=QueryString;
        entity.set(0,entityelement1);
        CqserviceCqop.Objects_element objectele=cqreq.CQQuery('UIPreview',entity);
        CqserviceCqop.Object_element[] obj=objectele.Object_x;
        CqserviceCqop.ObjectInfo_element objinfo=obj[0].ObjectInfo;
        htmlcode=objinfo.ObjectContent;
        return null;
        }

}   

 

In the above code,'htmlcode' is a string  variable contains HTML response from webservice.If i run the visualforce page,output will be as follows:

 

Output:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="icon" type="image/vnd.microsoft.icon" href="/cqweb/_rcm-resources/clearquest.ico"> <link rel="stylesheet" href="/cqweb/_rcm-resources/stylesheet/preview.css" type="text/css"> <title>Issue BETA00000565 - IBM Rational ClearQuest</title> </head> <body> <table class="header"><tr><td> <h2><img alt="Database" src="/cqweb/_rcm-resources/images/db.gif" style="vertical-align: middle; margin-right: 4px;">BETA/BETA</h2> </td><td class="navigation"> <select onchange="window.location.href = this.options[this.selectedIndex].value"> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=0">General</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=1">Description</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=2">Comments</option> <option selected="selected" value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=3">Customer Case</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=4">Environment/Attachments</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=5">Release Notes</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=6">History</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=7">Subscriber List</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=8">Links</option> </table> <table class="properties"> <tr><td class="name" style="width: 25%">SupportCases</td><td class="value" style="width: 25%"> </td> <td class="name" style="width: 25%">Hotfix Releases</td><td class="value" style="width: 25%"></td> </tr> <tr><td class="name" style="width: 25%">Category</td><td class="value" style="width: 25%"></td> <td class="name" style="width: 25%">Status</td><td class="value" style="width: 25%"></td> </tr> <tr><td class="name" style="width: 25%">SubCategory</td><td class="value" style="width: 25%"></td> <td class="name" style="width: 25%">Author</td><td class="value" style="width: 25%"></td> </tr> <tr><td class="name" style="width: 25%">Reviewer</td><td class="value" style="width: 25%"></td> <td class="name" style="width: 25%">Public Description</td><td class="value" style="width: 25%"></td> </tr> </table> </body> </html>

 

Here the problem was HTML tags are not executed.     

I have the following APEX class that was generated from a WSDL:

//Generated by wsdl2apex

public class soapBigmachinesCom {
    public class SecurityServicePort {
        public String endpoint_x = 'https://testEnvironment.bigmachines.com/v1_0/receiver';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        public soapBigmachinesCom.category_element category;
        public soapBigmachinesCom.xsdInfo_element xsdInfo;
        private String category_hns = 'category=urn:soap.bigmachines.com';
        private String xsdInfo_hns = 'xsdInfo=urn:soap.bigmachines.com';
        private String[] ns_map_type_info = new String[]{'urn:soap.bigmachines.com', 'soapBigmachinesCom'};
        public soapBigmachinesCom.loginResponse_element login(soapBigmachinesCom.LoginRequestUserInfoType userInfo) {
            soapBigmachinesCom.login_element request_x = new soapBigmachinesCom.login_element();
            soapBigmachinesCom.loginResponse_element response_x;
            request_x.userInfo = userInfo;
            Map<String, soapBigmachinesCom.loginResponse_element> response_map_x = new Map<String, soapBigmachinesCom.loginResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'urn:soap.bigmachines.com',
              'login',
              'urn:soap.bigmachines.com',
              'loginResponse',
              'soapBigmachinesCom.loginResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x;
        }
    }
    public class category_element {
        public String actor;
        public String mustUnderstand;
        private String[] actor_att_info = new String[]{'actor'};
        private String[] mustUnderstand_att_info = new String[]{'mustUnderstand'};
        private String[] apex_schema_type_info = new String[]{'urn:soap.bigmachines.com','true','true'};
        private String[] field_order_type_info = new String[]{};
    }
    public class loginResponse_element {
        public soapBigmachinesCom.CommonStatusType status;
        public soapBigmachinesCom.LoginResponseUserInfo userInfo;
        private String[] status_type_info = new String[]{'status','urn:soap.bigmachines.com','CommonStatusType','1','1','false'};
        private String[] userInfo_type_info = new String[]{'userInfo','urn:soap.bigmachines.com','LoginResponseUserInfo','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:soap.bigmachines.com','true','true'};
        private String[] field_order_type_info = new String[]{'status','userInfo'};
    }
    public class LoginResponseUserInfo {
        public String sessionCurrency;
        public String sessionId;
        public String actor;
        public String mustUnderstand;
        private String[] sessionCurrency_type_info = new String[]{'sessionCurrency','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] sessionId_type_info = new String[]{'sessionId','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] actor_att_info = new String[]{'actor'};
        private String[] mustUnderstand_att_info = new String[]{'mustUnderstand'};
        private String[] apex_schema_type_info = new String[]{'urn:soap.bigmachines.com','true','true'};
        private String[] field_order_type_info = new String[]{'sessionCurrency','sessionId'};
    }
    public class LoginRequestUserInfoType {
        public String username;
        public String password;
        public String sessionCurrency;
        public String sso;
        private String[] username_type_info = new String[]{'username','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] password_type_info = new String[]{'password','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] sessionCurrency_type_info = new String[]{'sessionCurrency','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] sso_type_info = new String[]{'sso','urn:soap.bigmachines.com','BooleanOrBlank','0','1','true'};
        private String[] apex_schema_type_info = new String[]{'urn:soap.bigmachines.com','true','true'};
        private String[] field_order_type_info = new String[]{'username','password','sessionCurrency','sso'};
    }
    public class xsdInfo_element {
        public String schemaLocation;
        public String actor;
        public String mustUnderstand;
        private String[] schemaLocation_type_info = new String[]{'schemaLocation','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] actor_att_info = new String[]{'actor'};
        private String[] mustUnderstand_att_info = new String[]{'mustUnderstand'};
        private String[] apex_schema_type_info = new String[]{'urn:soap.bigmachines.com','true','true'};
        private String[] field_order_type_info = new String[]{'schemaLocation'};
    }
    public class CommonStatusType {
        public String success;
        public String message;
        public Integer records_read;
        public Integer records_failed;
        public Integer records_deleted;
        public Integer records_returned;
        public String detail;
        public String warning;
        private String[] success_type_info = new String[]{'success','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] message_type_info = new String[]{'message','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] records_read_type_info = new String[]{'records_read','http://www.w3.org/2001/XMLSchema','int','0','1','true'};
        private String[] records_failed_type_info = new String[]{'records_failed','http://www.w3.org/2001/XMLSchema','int','0','1','true'};
        private String[] records_deleted_type_info = new String[]{'records_deleted','http://www.w3.org/2001/XMLSchema','int','0','1','true'};
        private String[] records_returned_type_info = new String[]{'records_returned','http://www.w3.org/2001/XMLSchema','int','0','1','true'};
        private String[] detail_type_info = new String[]{'detail','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] warning_type_info = new String[]{'warning','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] apex_schema_type_info = new String[]{'urn:soap.bigmachines.com','true','true'};
        private String[] field_order_type_info = new String[]{'success','message','records_read','records_failed','records_deleted','records_returned','detail','warning'};
    }
    public class fault_element {
        public String exceptionCode;
        public String exceptionMessage;
        public String exceptionDescription;
        private String[] exceptionCode_type_info = new String[]{'exceptionCode','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] exceptionMessage_type_info = new String[]{'exceptionMessage','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] exceptionDescription_type_info = new String[]{'exceptionDescription','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] apex_schema_type_info = new String[]{'urn:soap.bigmachines.com','true','true'};
        private String[] field_order_type_info = new String[]{'exceptionCode','exceptionMessage','exceptionDescription'};
    }
    public class login_element {
        public soapBigmachinesCom.LoginRequestUserInfoType userInfo;
        private String[] userInfo_type_info = new String[]{'userInfo','urn:soap.bigmachines.com','LoginRequestUserInfoType','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:soap.bigmachines.com','true','true'};
        private String[] field_order_type_info = new String[]{'userInfo'};
    }
}

 

Which when called as follows:

soapBigmachinesCom.LoginRequestUserInfoType sbmUI = new soapBigmachinesCom.LoginRequestUserInfoType();
sbmUI.username = 'test';
sbmUI.password = 'test';
soapBigmachinesCom.SecurityServicePort ssp = new soapBigmachinesCom.SecurityServicePort();
soapBigmachinesCom.category_element ce = new soapBigmachinesCom.category_element();

ssp.category = ce;
soapBigmachinesCom.xsdInfo_element ie = new soapBigmachinesCom.xsdInfo_element();
ie.schemaLocation = 'https://testenvironment.bigmachines.com/bmfsweb/testenvironment/schema/v1_0/security/Security.xsd';
ssp.xsdInfo = ie;

soapBigmachinesCom.loginResponse_element response = ssp.login(sbmUI);

 

creates the following request:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header>
    <category xmlns="urn:soap.bigmachines.com" />
    <xsdInfo xmlns="urn:soap.bigmachines.com">
      <schemaLocation>https://testenvironment.bigmachines.com/bmfsweb/testenvironment/schema/v1_0/security/Security.xsd</schemaLocation>
    </xsdInfo>
  </env:Header>
  <env:Body>
    <login xmlns="urn:soap.bigmachines.com">
    <userInfo>
        <username>test</username>
        <password>test</password>
        <sessionCurrency xsi:nil="true" />
        <sso xsi:nil="true" />
      </userInfo>
    </login>
</env:Body>
</env:Envelope>

 

How can I change my class (or how can I call it) to populate the category element value?

<category xmlns="urn:soap.bigmachines.com" />

 

to

<category xmlns="urn:soap.bigmachines.com" >Security</category>

 

  • February 14, 2013
  • Like
  • 0

Hi,

 

While working with KAV with the below query i got an error.

 

Can you please suggest me. How can i overcome this.

 

This is my query:

=================

List<knowledgearticleversion> lstKAV = new List<Knowledgearticleversion>();
lstKAV = [SELECT Title, Summary , PublishStatus
FROM KnowledgeArticleVersion
WHERE (PublishStatus='Online' OR PublishStatus='Draft' OR PublishStatus='Archieved')
AND Language = 'en_US'];

system.debug('****Lst of KAVS are ***'+lstKAV);

------------------------------------

Using the above i have to retrieve all Online, Draft and Archied articles.

 

 

My Error is :

=========

line 2, column 10: Implementation restriction: When querying or searching the KnowledgeArticleVersion object, you must filter using the following syntax: Id = [single ID], Id IN [list of ID's] or PublishStatus = [status]. In addition PublishStatus is only permitted in a top-level AND condition.

 

 

 

 

I'm getting the following error when running unit tests in our sandbox instance:

 

line -1, column -1: Previous load of class failed: changepasswordcontroller

 

Anyone else getting this?

Hi,

 

I have visualforce page with command link.when i click on the link,internally a webservice call happens,which returns HTML code to the controller in the form of string.can anyone provide solution to include that HTML code in visualforce page.

 

VisualForce Page:

 

<apex:page controller="testsearch">
<apex:form >
<apex:commandLink value="Click Me" action="{!testsearch1}">
<apex:param value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=3" assignTo="{!QueryString}"/>
</apex:commandLink>
</apex:form>
{!htmlcode}
</apex:page>

 

Controller Code:

 

public with sharing class testsearch {
public string QueryString{get;set;}
public String htmlcode{get;set;}
public PageReference testsearch1()
{
        Cqservice.CQOperationsPort cqreq=new Cqservice.CQOperationsPort();
        CqserviceCqop.entity_element[] entity=new CqserviceCqop.entity_element[5];
        CqserviceCqop.entity_element entityelement1=new CqserviceCqop.entity_element();
        entityelement1.entityName='QueryString';
        entityelement1.entityValue=QueryString;
        entity.set(0,entityelement1);
        CqserviceCqop.Objects_element objectele=cqreq.CQQuery('UIPreview',entity);
        CqserviceCqop.Object_element[] obj=objectele.Object_x;
        CqserviceCqop.ObjectInfo_element objinfo=obj[0].ObjectInfo;
        htmlcode=objinfo.ObjectContent;
        return null;
        }

}   

 

In the above code,'htmlcode' is a string  variable contains HTML response from webservice.If i run the visualforce page,output will be as follows:

 

Output:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="icon" type="image/vnd.microsoft.icon" href="/cqweb/_rcm-resources/clearquest.ico"> <link rel="stylesheet" href="/cqweb/_rcm-resources/stylesheet/preview.css" type="text/css"> <title>Issue BETA00000565 - IBM Rational ClearQuest</title> </head> <body> <table class="header"><tr><td> <h2><img alt="Database" src="/cqweb/_rcm-resources/images/db.gif" style="vertical-align: middle; margin-right: 4px;">BETA/BETA</h2> </td><td class="navigation"> <select onchange="window.location.href = this.options[this.selectedIndex].value"> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=0">General</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=1">Description</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=2">Comments</option> <option selected="selected" value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=3">Customer Case</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=4">Environment/Attachments</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=5">Release Notes</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=6">History</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=7">Subscriber List</option> <option value="http://ntcqsrv6.bedford.progress.com/cqweb/oslc/repo/BETA/db/BETA/record/16777434-33554997/preview?rcm.tabIndex=8">Links</option> </table> <table class="properties"> <tr><td class="name" style="width: 25%">SupportCases</td><td class="value" style="width: 25%"> </td> <td class="name" style="width: 25%">Hotfix Releases</td><td class="value" style="width: 25%"></td> </tr> <tr><td class="name" style="width: 25%">Category</td><td class="value" style="width: 25%"></td> <td class="name" style="width: 25%">Status</td><td class="value" style="width: 25%"></td> </tr> <tr><td class="name" style="width: 25%">SubCategory</td><td class="value" style="width: 25%"></td> <td class="name" style="width: 25%">Author</td><td class="value" style="width: 25%"></td> </tr> <tr><td class="name" style="width: 25%">Reviewer</td><td class="value" style="width: 25%"></td> <td class="name" style="width: 25%">Public Description</td><td class="value" style="width: 25%"></td> </tr> </table> </body> </html>

 

Here the problem was HTML tags are not executed.     

Using a Change Set to update sobjects and their Record Types?

Be sure check all your Profiles carefully. 

 

This lesson was learned after I migrated updates to the Case object along with custom code and a test class. I found that the tests that worked fine in sandbox were failing in production. I was getting errors like, "System.TypeException DML operation not allowed on Case" and a "not writable" error on a field that should have been writable. After checking the FLS and my Profile several times I noticed something I hadn't before: the Admin's Record Type Settings for Case was...blank! The act of updating the sobject must have cleared out the RT. Adding Record Types brought back joy.


NOTE: the code in question here WAS setting the record type on the Case object it was creating but that didn't matter.

public class BusTicketExtension { private final BusTicket__c BusTicket; public BusTicketExtension (ApexPages.StandardController stdController) { this.BusTicket = (BusTicket__c)stdController.getRecord(); } public PageReference save() { insert(BusTicket); PageReference p = Page.NewSystemTicket; p.getParameters().put('msg','Thank you for submitting your ticket, someone will get back to you soon.'); p.setRedirect(true); return p; } public static testMethod void testBusTicketExtension() { PageReference pageRef = Page.NewSystemTicket; Test.setCurrentPage(pageRef); BusTicket__c bt = new BusTicket__c(system__c='Salesforce.com',category__c='access',title__c='MyTest'); ApexPages.StandardController btc = new ApexPages.Standardcontroller(bt); BusTicketExtension controller = new BusTicketExtension(btc); String nextPage = controller.save().getUrl(); System.assertEquals('/apex/newsystemticket?msg=Thank+you+for+submitting+your+ticket%2C+someone+will+get+back+to+you+soon.',nextPage); BusTicket__c t=[SELECT system__c FROM BusTicket__c WHERE createdDate = TODAY and title__c = 'MyTest' ]; System.assertEquals('Salesforce.com',t.system__c); } }

 I'm not really worried about the validity of the test, since the only reason I wrote the code was to support public submission to the custom object.  I've also written a VF page that's referenced in the above controller, so I can just ship them back to the input page with a message thanking them for their submission.

 

I have tried every different way I know of to deploy this code from a sandbox to production.  In my IDE AND in the sandbox org, running tests on the class pass with 100% test coverage.

 

I've tried running Deploy to server in the IDE

I've tried creating a Change Set.

 

Thanks in advance if anyone sees anything I'm missing.

 

Barry