Rightnow Customer Portal development
Disclaimer: All the information here is mostly
self-taught or self-learned – I do not have any direct contact with the
RightNow development team and anything I say here is completely based on my understanding and could be completely
wrong. Please refer to your Rightnow documentation /community for official
support.
If you are a customer using the RightNow customer portal –
you obviously at some point of time had the question – how do I setup something
new – be it a new page, a new functionality on the site etc.
It may seem a bit daunting at the beginning - but if you
have some good PHP programmer in your payroll, it is not as difficult as it
seems. You don’t have to go to Professional services every time you need some
new feature – and trust me on this – you really don’t! I will elaborate on when
it is wiser to go to professional services vs DIY later in the post.
Ok first things first –
Everything I am going to describe here applies to the “Customer
Portal” version – so if you are using classic pages from RightNow – most of
this does not apply to you and I have no suggestions for you since I have not
worked on the Classic pages interface.
Components of the system
With the Rightnow Customer portal – everything works on the
familiar MVC principle. There are a few terms you have to be familiar with here
–
·
Page
Every time you load an URL, you are calling a page – eg: /app/home or /app/answers/detail etc.
Every time you load an URL, you are calling a page – eg: /app/home or /app/answers/detail etc.
·
Template
Templates are used by pages – this way you can define a single template containing your headers, footers, CSS Styles etc and use it across multiple pages.
Templates are used by pages – this way you can define a single template containing your headers, footers, CSS Styles etc and use it across multiple pages.
·
Widgets
Widgets are functional elements in a page which provide user interaction or display specific content on the page. A page may contain one or more widgets. And widgets comprise of the following:
Widgets are functional elements in a page which provide user interaction or display specific content on the page. A page may contain one or more widgets. And widgets comprise of the following:
o
Model
o
View
o
Controller
Here is my take at how the architecture works –
When you call a page on the Rightnow Customer Portal – Eg:
/app/home – you are calling a page called home.php
Now Pages use templates – which helps you to share the same
CSS Styles, Headers, Footers etc across multiple pages. If you open the page,
you will see what template it is using by looking at the template attribute:
Eg:
< rn:meta template="customtemplate.php"
clickstream="answer_list" use_profile_defaults="true"
login_required="true"/ >
In the above example, you see that the page is using a
template called “customtemplate.php”
Normally you will find the pages & template in the
following folders:
views/pages – for pages
views/templates – for templates used by the pages.
Depending on the functionality of a page, it may contain one
or more Widgets.
An example of a widget would be: My Incidents – where the
widget displays incidents logged by a specific user.
Rightnow comes with several standard widgets. However, it
might be necessary to additional widgets based on your requirement.
Custom widgets (those developed by your organization) are
found in: widgets\custom folder.
At this time, I would encourage to take a look at your
existing website and see how things are setup.
To do so – login in to your development interface using Web
DAV and go to the /dav/euf/development folder.
Inside the /dav/euf/development folder you will find the
following folders:
views/pages (contains all your pages eg: /app/home will be
views/pages/home.php)
views/templates (contains all templates used by your pages)
widgets/custom (contains all widgets that are reference by
your pages)
Models
At this point – I would like to interject and talk about
“Models”
If you are familiar with the MVC paradigm, you would
probably find it easier to understand what models in Rightnow do – Models in
Rightnow platform interact with objects (such as answers, incidents etc) to get
information about a specific instance or create a new instance or update an
existing instance.
An example:
Imagine you want to create a new answer – this logic would
be defined inside a model and the model will be used by your widget which will
be the frontend to the end user for gathering the necessary information to
create the answer.
I am not going to get into the details of how to create a
new model or new view or new page etc. Please refer to the customer portal
architecture document from Rightnow: http://www.rightnow.com/pdf/Customer%20_ortal_Architecture-An_Introduction_to_the_Customer_Portal_Framework.pdf
Widgets
Let us talk about Widgets for a moment – The widgets provide
the functionality to every page and is the front end for users to interact with
the Rightnow system.
The widgets themselves contain the following components:
· Controllers – controller.php
Controller is responsible for interacting with data models within rightnow system and gather all the necessary data and pass them on to a view.
Controller is responsible for interacting with data models within rightnow system and gather all the necessary data and pass them on to a view.
·
View – view.php
Views get the data passed by its controller and presents them in a display format defined in the view.
Views get the data passed by its controller and presents them in a display format defined in the view.
·
Functionality Logic – logic.js
Widgets may provide interactive functionality – such as submitting a form, creating a new answer, updating an incident etc. These activities are handled via AJAX requests and they are defined in the logic.js
Widgets may provide interactive functionality – such as submitting a form, creating a new answer, updating an incident etc. These activities are handled via AJAX requests and they are defined in the logic.js
Deep dive into Models
Now, let us talk about models and how they interact with the
system to manipulate various objects such as answers, incidents etc.
Before the introduction of the Connect API, the models often
interacted with the objects using SQL queries. The Connect API defines object
classes which you can use to interface with various components of the system.
Eg: The Answer object allows you to manipulate a Rightnow
answer etc.
Connect API comes in different forms as you will see here: http://www.rightnow.com/cx-suite-connect.php
I have used the Connect PHP and Connect SOAP in my personal
integration work and I would only focus on those in this article.
The Connect PHP API can be used within the Rightnow models
to perform actions on various components. This allows you to manipulate
components using standard objects instead of writing custom queries – without the
fear of the query breaking in the next upgrade cycle.
The Connect SOAP API is useful if you want to expose objects
within your RightNow instance to external 3rd party applications.
You will find the full API documentation of the same here:
Connect PHP: http://community.rightnow.com/developer/fileexchange/Connect_PHP_November_2010/Default.htm
Connect SOAP: http://community.rightnow.com/developer/fileexchange/Connect_Web_Services_for_SOAP_August_2011/Default.htm
A Sample Application
Without getting too much into the specifics, I would like to
explain how I would create a new functionality on the Customer portal.
Requirement:
Display the list of Answers that are assigned to me
(assuming this page will be only accessible by logged in users who are setup as
RightNow Named contacts)
So – in this scenario – the first thing I will do is to
define a model or a method inside an existing model which will load the Answers
Object (using connect php) and query for answers matching my critieria –
assigned to = user logged in to the session.
At this time, the user can be a parameter which will be passed by the widget.
Then I will define a widget, which will use the model and
the method to obtain the list of answers by calling the Model and method you
have defined. You could pass the logged in user to the Model from the widget.
This is typically done in the Widget’s controller. The Widget’s controller
would then pass this data along to the view.
The view would get the resulting list of answers and present
it in a suitable format such as an HTML unordered list.
Now, you can embed this widget on any page and in-turn the
page could use a template to define how the whole page looks.
So that would be the sample run down of the application.
How do I create an AJAX interface?
Before we get to how do we create it, let us talk about why
we need it. Imagine you need to create a new widget which would gather
information from an end-user and log it as an incident within RightNow.
Now your widget would provide the user interface through the
view.php. When the user performs an action such as submit the incident, now you
need to save it.
If you are a traditional PHP or any web programmer, your web
page would submit to another webpage which will take care of handling the
saving part.
But in Rightnow, a page may contain more than one widgets.
So you are not going to submit and reload the whole page because one of your
widgets needs to perform some action. Instead – your widget will make an AJAX
call (defined in logic.js) to interact with the backend system and make the
necessary updates. Once the AJAX call is complete, your widget could refresh
and display the result of the action.
Ok – now that said, how do I define AJAX call points which I
can use on Widgets?
To do so, you will define a new Controller to handle AJAX
functions. Controllers are defined in the controllers directory and each
controller extends the standard Rightnow Class “Controller” Each function
defined in the controller can be exposed as external methods that can be used
by widgets.
Summary
Rightnow customer portal is a flexible system – with the
help of some PHP developers, you can customize your portal by adding or modifying
functionality of the site.
When to use professional services?
Well, this is only my recommendation and purely based on
resources constraints we have in my team. Generally I feel that anything that
has to be done with objects that have already been setup or that can be easily
setup using your Rightnow Administration console – you can do it yourself.
However, if you are looking to setup a functionality with an
object which is complex and difficult to setup using the Rightnow
administration console, go for professional services.
2 comments:
I am curious to find out what blog system you are utilizing?
I'm experiencing some small security problems with my latest website and I would like to find something more safeguarded. Do you have any solutions?
My site :: トリーバーチ店舗
It's going to be ending of mine day, except before end I am reading this wonderful piece of writing to increase my know-how.
my blog post ... エアジョーダン通販
Post a Comment