You need to sign in to do that
Don't have an account?
vijay jillella 9
urgent salesforce integration with indeed job board with rest api
urgent salesforce integration with indeed job board with rest api
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Can you please elaborate the requirement.
Thanks,
Gaurav
Skype: gaurav62990
APEX:For XML Creation
public with sharing class XMLCreationIndeed {
//public String jobXML1{get;set;}
public String jobXML{get;set;}
public list<PositionForindeed__c> joblist{get;set;}
// public PositionForindeed__c jb{get;set;}
/* public string requiredXml1= '<?xml version=\'1.0\' encoding=\'utf-8\'?>\n'+
'<source>\n'+
'<publisher>Monster IN</publisher>\n'+
'<publisherurl>http://jobs.monsterindia.com/details/22109069</publisherurl>\n'+
'<lastBuildDate>Fri, 10 Dec 2004 22:49:39 GMT</lastBuildDate>\n';
public string requiredXml2='</source>';*/
public XMLCreationIndeed(ApexPages.StandardController controller) {
joblist=[select name,Company_Name__c,Open_Date__c,referencenumber__c,Location__c,state__c,country__c,Job_Status__c ,pinCode__c,description__c,Max_Pay__c,Educational_Requirements__c,JobType__c,Functional_Area__c,experience__c from PositionForindeed__c];
// jb = (PositionForindeed__c )controller.getRecord();
}
public Document document {
get {
if (document == null)
document = new Document();
return document;
}
set;
}
// public void GenerateXML(){
public pagereference GenerateXML(){
XmlStreamWriter w = new XmlStreamWriter();
w.writeStartDocument(null,'1.0 encoding=UTF-8');
// w.writeStartDocument('utf-8', '1.0');
w.writeStartElement(null,'source',null);
// w.writeAttribute(null, null, 'publisher', 'Super X Job Site');
w.writeStartElement(null, 'publisher', null);
w.writeCharacters('EmployAstar');
w.writeEndElement();
w.writeStartElement(null, 'publisherurl', null);
w.writeCharacters('http://www.employastar.com/');
w.writeEndElement();
w.writeStartElement(null, 'lastBuildDate', null);
w.writeCharacters('Fri, 05 may 2018 22:49:39 GMT');
w.writeEndElement();
for(PositionForindeed__c jb : joblist) //and (position__c.Job_Status__c == 'open') )
{
if(jb.Job_Status__c == 'open')
w.writeStartElement(null,'job',null);
w.writeStartElement(null, 'title', null);
w.writeCharacters('![CDATA['+jb.name+']]');
// w.writeCData(jb.name);
w.writeEndElement();
w.writeStartElement(null, 'Company', null);
w.writeCharacters('![CDATA['+jb.company_name__c+']]');
//w.writeCData(jb.Open_Date__c);
w.writeEndElement();
w.writeStartElement(null, 'SourceName', null);
w.writeCharacters('![CDATA['+jb.company_name__c+']]');
//w.writeCData(jb.Open_Date__c);
w.writeEndElement();
w.writeStartElement(null, 'date', null);
w.writeCharacters('![CDATA['+jb.Open_Date__c+']]');
//w.writeCData(jb.Open_Date__c);
w.writeEndElement();
w.writeStartElement(null, 'referencenumber', null);
//w.writeCData(+jb.referencenumber__c);
w.writeCharacters('![CDATA['+jb.referencenumber__c+']]');
w.writeEndElement();
w.writeStartElement(null, 'Url', null);
// w.writeCharacters('\n![CDATA[http://www.superxjobsite.com/viewjob.cfm?jobid=unique'+jb.referencenumber__c+']]\n');
w.writeCData('https://employastar.secure.force.com/careers/'+jb.referencenumber__c);
w.writeEndElement();
w.writeStartElement(null, 'city', null);
w.writeCharacters('\n![CDATA['+jb.Location__c+']]\n');
//w.writeCData(jb.Location__c);
w.writeEndElement();
w.writeStartElement(null, 'state', null);
w.writeCharacters('\n![CDATA['+jb.state__c+']]\n');
//w.writeCData(jb.state__c);
w.writeEndElement();
w.writeStartElement(null, 'Country', null);
w.writeCharacters('![CDATA['+jb.country__c+']]\n');
//w.writeCData(jb.country__c);
w.writeEndElement();
w.writeStartElement(null, 'postalcode', null);
w.writeCharacters('\n![CDATA['+jb.pinCode__c+']]\n');
// w.writeCData(jb.pinCode__c);
w.writeEndElement();
w.writeStartElement(null, 'description', null);
w.writeCharacters('\n![CDATA['+jb.description__c+']]\n');
//w.writeCData(jb.description__c);
w.writeEndElement();
w.writeStartElement(null, 'salary', null);
w.writeCharacters('\n![CDATA['+jb.Max_Pay__c+']]\n');
//w.writeCData(jb.Max_Pay__c);
w.writeEndElement();
w.writeStartElement(null, 'Education', null);
w.writeCharacters('\n![CDATA['+jb.Educational_Requirements__c+']]\n');
// w.writeCData(jb.Educational_Requirements__c);
w.writeEndElement();
w.writeStartElement(null, 'JobType', null);
w.writeCharacters('\n![CDATA['+jb.JobType__c+']]\n');
// w.writeCData(jb.JobType__c);
w.writeEndElement();
w.writeStartElement(null, 'Category', null);
w.writeCharacters('\n![CDATA['+jb.Functional_Area__c+']]\n');
//w.writeCData(jb.Functional_Area__c);
w.writeEndElement();
w.writeStartElement(null, 'experience', null);
w.writeCharacters('\n![CDATA['+jb.experience__c+']]\n');
// w.writeCData(jb.experience__c);
w.writeEndElement();
system.debug('====================================Indeed apply data=====================================');
w.writeStartElement(null, 'indeed-apply-data', null);
/* w.writeCharacters('<<![CDATA['+
'indeed-apply-joburl=http%3A%2F%2FJill-Gaba.SFAgentJobs.com%2Fj%2F0b0yx'+
'&indeed-apply-jobid='+jb.referencenumber__c+
'&indeed-apply-jobtitle='+jb.name+
'&indeed-apply-jobcompanyname=EmployAstar'+
'&indeed-apply-joblocation='+jb.Location__c+
'&indeed-apply-apitoken=9999e3bb3112cfa022da0f864850d13c8a9387d6f336830b5d74c7bff67d74199'+
'&indeed-apply-posturl=http%3A%2F%2Fapp.careerplug.com%2Fjobs%2F1928%2Fapps.json'+
'&indeed-apply-phone=required'+
'&indeed-apply-questions=http%3A%2F%2Fapp.careerplug.com%2Fjobs%2F1928%2Fquestions.json'+']]>>');*/
w.writeCData('\nindeed-apply-joburl=https%3A%2F%2Femployastar.secure.force.com%2Fcareers%2F'+
'&indeed-apply-jobid='+jb.referencenumber__c+
'&indeed-apply-jobtitle='+jb.name+
'&indeed-apply-jobcompanyname='+jb.Company_Name__c+
'&indeed-apply-joblocation='+jb.Location__c+','+jb.state__c+','+jb.country__c+','+jb.pinCode__c+
'&indeed-apply-apitoken=d2f9d7492a037d7f8788f5daff4bed03a6101d29224e4f257be264441fe720d8'+
'&indeed-apply-email=bd60380bfbcbfe4c08fa2f6e077da3dd101035593ee0ad56342eee660ba1810c');
w.writeEndElement();
w.writeEndElement();
}
w.writeEndDocument();
jobXML = w.getXmlString();
w.close();
// jobxml=requiredXml1+jobXML1+requiredXml2;
system.debug('=================================================='+jobXML);
document.AuthorId = UserInfo.getUserId();
document.FolderId = UserInfo.getUserId();
try {
Blob txtBlob = Blob.valueOf(jobXML);
document.Body = txtBlob;
document.Name='IndeedXMl'+'.xml';
} catch (DMLException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
} finally {
//document.body = null; // clears the viewstate
if (document == null){
INSERT document;
}
else
{
// Document docToUpdate = [SELECT id, body FROM document WHERE DeveloperName='CABIAEBJA2bbc933ddc1f466a8d124ca8f5c40313'];
Document docToUpdate = [SELECT id, body FROM document where id='01546000000CEsf'];
Blob txtBlob=DOCUMENT.BODY;
docToUpdate.body = txtBlob;
update docToUpdate;
}
}
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully and click confirm to complete or post new jobs'));
Return null;
}
//document = new Document();
public pagereference confirmPost(){
PageReference pgref = page.Xmlcreationindeedvfp;
pgref.setRedirect(true);
return pgref;
}
}
VF page----------------------------------------to show list of jobs in sites
<apex:page standardController="PositionForindeed__c" recordSetVar="Items" extensions="talentforjobs" showHeader="false" wizard="true" standardStylesheets="true" showheader="false" applyBodyTag="false" docType="html-5.0">
<apex:pagemessages />
<apex:pageBlock Title="Careers" >
<apex:form >
<apex:outputPanel styleClass="panelWrapper" layout="block" >
<apex:pageblockSection columns="1">
<apex:repeat value="{!items}" var="a" rendered="">
<apex:pageBlockSection title="{!a.name}" collapsible="false" columns="1" >
<apex:outputText >Company Name:{!a.Company_Name__c}</apex:outputText>
</apex:pageBlockSection>
<apex:outputText >Job Id:{!a.referencenumber__c}</apex:outputText>
<apex:outputText >Date:{!a.Open_Date__c}</apex:outputText>
<apex:outputText >Job Description: {!a.Description__c}</apex:outputText>
<apex:outputText >Qualifications:{!a.Educational_Requirements__c}</apex:outputText>
<apex:outputText >Experience:{!a.Experience__c}</apex:outputText>
<apex:outputText >Status:{!a.Job_Status__c}</apex:outputText> <br></br> <br></br> <br></br> <br></br>
<apex:commandlink Value="Apply job" action="{!ApplyforJob}" styleClass="button" />
</apex:repeat>
</apex:pageblockSection>
</apex:outputPanel>
</apex:form>
</apex:pageBlock>
</apex:page>