OAI and Workflow - Setting Attributes to use in Notifications

Does anyone know how I go about getting at attributes in a message that goes through the Workflow Adapter?
What I am trying to do is to create a notification, which is more meaningful by adding some of the details I've passed through in the PARAMETER_LIST attributes of the Workflow message.
Any ideas?
Ian

Kavitha,
I've managed to do it, but using a simpler method (I think).
In iStudio
My Common View contains the attributes as follows:-
EMPLOYEE_NUMBER (String)
START_DATE (Date)
LAST_NAME (String) and
FIRST_NAME (String)
My subscribing Workflow Event maps these Common View values into the PARAMETER_LIST array in the Workflow message. The mappings are as follows:-
PARAMETER_LIST[v1].NAME=SetConstant (EMPLOYEE_NUMBER, "EMPLOYEE_NUMBER")
PARAMETER_LIST[v1].VALUE=CopyFields (EMPLOYEE_NUMBER)
PARAMETER_LIST[v2].NAME=SetConstant (START_DATE, "START_DATE")
PARAMETER_LIST[v2].VALUE=CopyFields (START_DATE)
PARAMETER_LIST[v3].NAME=SetConstant (LAST_NAME, "LAST_NAME")
PARAMETER_LIST[v3].VALUE=CopyFields (LAST_NAME)
PARAMETER_LIST[v4].NAME=SetConstant (FIRST_NAME, "FIRST_NAME")
PARAMETER_LIST[v4].VALUE=CopyFields (FIRST_NAME)
I also created the publishing Workflow Event. To get the values out of the PARAMETER_LIST array, I simply used the 'TrueConditionalCopy' transformation. For example,
EMPLOYEE_NUMBER=TrueConditionalCopy (PARAMETER_LIST[v1].NAME, PARAMETER_LIST[v1].VALUE, "EMPLOYEE_NUMBER")
In Workflow Builder
I created 4 additional ATTRIBUTES in the Workflow:-
EMPLOYEE_NUMBER_ATT (Type - Text)
START_DATE_ATT (Type - Text)
LAST_NAME_ATT (Type - Text) and
FIRST_NAME_ATT (Type - Text)
I then created my MESSAGE (Called 'Approve Update Employee'). I added 4 new MESSAGE ATTRIBUTES to this message:-
EMPLOYEE_NUMBER (Type - Text, Default Type - Item Attribute, Value - EMPLOYEE_NUMBER_ATT)
START_DATE (Type - Text, Default Type - Item Attribute, Value - START_DATE_ATT)
LAST_NAME (Type - Text, Default Type - Item Attribute, Value - LAST_NAME_ATT)
FIRST_NAME (Type - Text, Default Type - Item Attribute, Value - FIRST_NAME_ATT)
In the Message Body I used the '&EMPLOYEE_NUMBER' notation to bring back the values into the message when the Workflow runs. For example, "This message has been created to tell you that Employee &EMPLOYEE_NUMBER has changed some details. Details are First Name is &FIRST_NAME, Last Name is &LAST_NAME and their start date is &START_DATE. Please Approve or Reject this change by using the buttons below."
In the Workflow Diagram
After the START node (Subscribe Maintain_Employees.Update_Employees) I added a series (4 in all) of "Get Event Property" Standard Workflow functions (GETEVENTPROPERTY) in order to find out the values from my parameter list.
As an example, here is the one I did to get the Employee Number.
In the 'Node Attributes' tag (when you double-click on the "Get Event Property") set the values as follows:-
Name = Event, Type = Item Attribute, Value = OAI Message
Name = Property, Type = Constant, Value = Event Parameter
Name = Event Parameter, Type = Constant, Value = EMPLOYEE_NUMBER
Name = Item Attribute, Type = Constant, Value = EMPLOYEE_NUMBER_ATT
(Note that the 'Event Parameter' is the name you set it to when you did the SetConstant mapping i.e. EMPLOYEE_NUMBER. The 'Item Attribute' is the target ATTRIBUTE that the result of calling the GETEVENTPROPERTY will be put.)
I finished off the Workflow by creating a NOTIFICATION called 'Update Employee Notification' which uses the 'Approve Update Employee' message, and added the Result Type of 'Approval'.
If the message is APPROVED, then the workflow calls the Publish Event (END node type), if REJECTED then the Workflow goes to an END node (and not processed any further).
My Workflow looks like this.
START (Subscribe Maintain_Employees.Update_Employees)
GETEVENTPROPERTY (to get EMPLOYEE_NUMBER_ATT value)
GETEVENTPROPERTY (to get START_DATE_ATT value)
GETEVENTPROPERTY (to get LAST_NAME_ATT value)
GETEVENTPROPERTY (to get FIRST_NAME_ATT value)
Update Employee Notification --> REJECTED --> END
APPROVED
END (Publish Maintain_Employees.Update_Employee)
I'm not sure whether this is a good approach or not. The biggest upside is that I didn't have to do any additional coding. I only used standard OAI and Workflow functionality.
Thanks again for your help.
Ian

Similar Messages

  • My daughter received an I phone for Christmas and we set it up using my iTunes account.  She just received an iPad and wants to set up her own iTunes account.  How do we do that without lsing all of her content that she added to my iTunes account.

    My daughter received an I phone for Christmas and we set it up using my iTunes account.  She just received an iPad and wants to set up her own iTunes account.  How do we do that without losing all of her content that she added to my iTunes account. I have home sharing on my account.

    Welcome to the Apple Community.
    If she creates her own iTunes account she can't use any protected content purchased under another account. She can play unprotected content synced from an iTunes library on a computer, but she can only download content from the cloud that is purchased under her account.
    It's a pain I know, but the longer you put off the move, the worse the situation will become.

  • Scripts and Workflows set as iCal alarms not functioning in Lion...

    ...or it could be becuase i am using a Beta version related to the Beta for iClloud and iOS5....I'm not 100% sure....
    All I know is that I have scripts and workflows that used to work before the upgrade, they STILL work when I run them independantly using Script editor and Automator, but they do not run when the iCal alarm that they are tied to goes off.  Coem to think of it, the only way that i know those alrms are going off is that I get a notification on my synced iPhone that tells me they are going off.  - so i guess I really don't know if those alarms are working on my mac at home.
    any thoughts or help?

    For me it's completely random. Some examples of what's happened to me...
    - I've set a new alarm (that I need to go off weekly) When I first set it it will pop up, but then the next week it will not. But then sometimes it will.
    - I also have an alarm to check woot.com everyday that NEVER goes off.
    I don't know if anyone else is having this problem (or if it's related) but something else also started happening the same time I installed Leopard... Occasionaly whatever window in any program I'm working in will all of a sudden go inactive / ghosted so I'm not able to type, etc. I have to click on the window I was working in to make it active again.
    The tech I talked to thought that perhaps a pop up alarm was popping up OFF screen and therefore causing the inactive window problem. But after erasing all the info in my iCal (that's right, EVERY appointment had to be reentered) I know for a fact that's not the problem.

  • Set attribute value using plugins

    Hi Experts,
    I am facing error when setting the value of attribute in the event "OnInvestigationStartedEvent". Any suggestion to fix the issue
    code:
                Session ses = onInvestigationStartedEvent.getSessionContext().getInterviewSession().getRuleSession();
                Attribute start = ses.getGlobalEntityInstance().getEntity().getAttribute("test_start_time");
                Date start_date = new Date();
                start.setValue(ses.getGlobalEntityInstance(), start_date);
    Error:
    25750 [http-apr-8080-exec-9] INFO com.oracle.determinations.engine.Session  - User setting attribute test_start_time, entity global, instance name global, session 1 to value 7/21/13 2:17 PM
    25752 [http-apr-8080-exec-9] ERROR com.oracle.determinations.web.platform.templatingengine.ErrorRenderer  - A unauthorised change to the Rule Session has been detected.
    com.oracle.determinations.interview.engine.exceptions.CorruptSessionException: A unauthorised change to the Rule Session has been detected.
      at com.oracle.determinations.interview.engine.data.local.RuleSessionManager.checkSessionIntegrity(RuleSessionManager.java:760)
      at com.oracle.determinations.interview.engine.data.local.RuleSessionManager.getRuleSession(RuleSessionManager.java:144)
      at com.oracle.determinations.interview.engine.local.LocalInterviewSession.getRuleSession(LocalInterviewSession.java:203)
      at com.oracle.determinations.interview.engine.data.model.InterviewEntityInstanceIdentifier.findEntityInstance(InterviewEntityInstanceIdentifier.java:73)
      at com.oracle.determinations.interview.engine.local.AttributeGoal.getNextScreen(AttributeGoal.java:112)
      at com.oracle.determinations.interview.engine.local.LocalInterviewSession.getNextScreen(LocalInterviewSession.java:222)
      at com.oracle.determinations.web.platform.controller.actions.InvestigateAction.getResource(InvestigateAction.java:65)
      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServlet.doGet(WebDeterminationsServlet.java:112)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.oracle.determinations.web.platform.util.CharsetFilter.doFilter(CharsetFilter.java:46)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
    Thanks,
    Vinay

    Vinay,
    When working in an Interview Engine event handler, you need to use Interview Engine objects to set values. Have a look at the example "Use the OnInterviewSessionCreatedEvent to pre-seed data into a newly created session" in the "Oracle Policy Automation Developer's Guide"
    Your code should look something like:
    // get the globalInstance from a new InterviewUserData;
    InterviewUserData data = new InterviewUserData();
    InterviewEntityInstance globalInstance = data.getGlobalInstance();
    // set the test_start_time
    Date start_date = new Date();
    globalInstance.setValue("test_start_time", start_date );
    // submit the data to the Interview session.
    TransactionResult result = session.submit(data);
    Hope this helps.
    Cheers
    Frank

  • I tried opening a pdf file and I set it to use always and firefox which did not work, I was wondering how to undo that and what I should use to open pdf files in the future?

    I was attempting to open a document from a frequently used site, I had never been on, on my new mac however. I attempted to open the pdf file and was given the option of which program to use to open it, I mistakenly clicked use always and firefox as the program with which to open pdf files. I do not know how to undo this or what I should do in the future to access the pdf files.

    Hi Melfour-
    Here is a Support article detailing how to work with your Firefox PDF preferences:
    [[Opening PDF files within Firefox]]
    Hope that helps.

  • How to add set attribute method in webdynpro abap using code wizard.

    Hi developer,
    I am new to webdynpro abap , i have developed a small component from sap technical abap but i am not able to add the set attribute method using read context node /attribute in wizard code ,pleae guide me in solution.
    thanks,
    ravi.

    Hi,
    could you copy / past your code ?
    if you need help on webdynpro and your beginner, try to watch the video on internet of WebBProfessor. It's really good videos !
    regards
    Fred

  • FIM Workflow custom activity - Get the workflow/set name

    Hi,
    How can I get the name of the workflow/set that triggered my custom activity?
    I'm planning to make my custom activity to have diferent behaviour depending on the ResourceType, action(modify, create) and
    workflow/set name that "triggered" it
    Many thanks,
    DD

    CurrentRequestActivity Class has a property called
    CurrentRequest this class is available to you in your activity (See example) This returns a
    RequestType object which has a
    ManagementPolicyRules member which leads to the set(s) involved. It also has an
    ActionWorkflowInstances property 
    However, what you are doing breaks the encapsulation of the activity. The activity should be like a black box to the admin -- feed in the same parameters in config and the same data at runtime and I get the same result. Having it depend on the workflow MPR
    or set makes that impossible. I would suggest separate workflow activities in different workflows. It will be cleaner encapsulation and make the life of the FIM admin easier.
    David Lundell, Get your copy of FIM Best Practices Volume 1 http://blog.ilmbestpractices.com/2010/08/book-is-here-fim-best-practices-volume.html

  • How to set cookie value in one page and retrieve in another page using setA

    How to set cookie value in one page and retrieve in another page using setActionListener?
    I have tried with following code srcpage.jspx->destpage.jspx
    srcpage.jspx
    <af:table value="#{bindings.DepartmentsView1.collectionModel}"
    var="emp" rows="#{bindings.EMPView1.rangeSize}"
    first="#{bindings.EMPView1.rangeStart}"
    emptyText="#{bindings.DepartmentsView1.viewable ? 'No rows yet.' : 'Access Denied.'}">
    <af:column sortProperty="EmployeeName" sortable="false"
    headerText="Cookie Testing">
    <af:commandLink text="#{emp.EmployeeName}" action="success">
    <af:setActionListener from="#{emp.EmployeeName}"
    to="#{cookie}"/>
    </af:commandLink>
    </af:column>
    </af:table>
    espage.jspx
    <af:outputText value="Test Cookie Value: #{cookie}"/>
    ,Here Test Cookie Value prints the following instead of its original String value
    {JSESSIONID=javax.servlet.http.Cookie@7da288, oracle.uix=javax.servlet.http.Cookie@399f62}
    I have passed employee name "Robert" to cookie in srcpage.jspx,but it prints "JSESSIONID....." instead of "Robert" in destpage.jspx
    Thanks in advance
    Kalee

    Hi,
    "cookie" is a reserved name. If you want to write to a session scope attribute called "cookie" then you have to call #{sessionScope.cookie}. If you want to use EL to set and read from cookies then you will have to use
    #{cookie.cookieName}
    Note that #{cookie} writes to and returns a map
    check this: http://www.informit.com/articles/article.aspx?p=30946&seqNum=7
    Frank

  • WorkFlow get triggered even if we set trigger for item update with SPEmailEventReceiver and workflow attached to same Library

    Hi All,
               I have a situation, SPEmailEventReceiver and WorkFlow is attached to same library, WorkFlow is configured to run after item is updated, but soon as the email is received in library the workflow
    is getting triggered, We have a action to create folder with subject and date and put the attachment with the date folder in SPEmailEventReceiver e.g: once a mail is received in library the SPEmailEventReceiver will create a folder with Subject and then Folder
    with Date and then put the attachment in the date folder so hierarchy will be subject folder/Date folder/attachment
    I have tried to alter the SquenceNumber attribute in Feature Element file to 1 and make the Synchronization as synchronous but no luck.

    Hi,
    Here are some articles for your reference:
    Programmatically creating Folders within SharePoint List
    http://www.mindfiresolutions.com/Programmatically-creating-Folders-within-SharePoint-List-487.php
    How to use SPEmailEventReceiver?
    http://kkryczka.wordpress.com/2010/11/05/how-to-use-spemaileventreceiver/
    Attachments disappear with custom email event handler
    http://blogs.msdn.com/b/malag/archive/2009/05/13/attachments-disappear-with-custom-email-event-handler.aspx?PageIndex=2
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • How to create a user using XML and specifying addional attributes that are objects

    I'm trying to create a user using XML and specifying some attributes that are objects and not sure how to do it. How would I set the DirectoryUserAcl to Public?
    Here's the xml file:
    <?xml version = '1.0' standalone = 'yes'?>
    <SimpleUser>
    <UserName>mike2</UserName>
    <Password>abc123</Password>
    <AdminEnabled>false</AdminEnabled>
    <HomeFolderRoot>/home</HomeFolderRoot>
    <HasContentQuota>false</HasContentQuota>
    <DirectoryUserAcl> ??? </DirectoryUserAcl>
    <DefaultAclBundleAcl> ??? </DefaultAclBundleAcl>
    <HomeFolderPolicyBundleAcl> ??? </HomeFolderPolicyBundleAcl>
    </SimpleUser>

    I figured out the answer:
    <?xml version = '1.0' standalone = 'yes'?>
    <SimpleUser>
    <UserName>mike2</UserName>
    <Password>abc123</Password>
    <AdminEnabled>false</AdminEnabled>
    <HomeFolderRoot>/home</HomeFolderRoot>
    <HasContentQuota>false</HasContentQuota>
    <DirectoryUserAcl classname="SystemAccessControlList" refType="name">Public</DirectoryUserAcl>
    </SimpleUser>
    null

  • What sequence setting would you use to edit 1280 x1080 DVCProHD (P2) and 1920 x 1080 AVCHD (Sony) in FCP. Experiencing Quality and rendering issues.

    What sequence setting would you use to edit both 1280 x1080 DVCProHD (P2) and 1920 x 1080 AVCHD (Sony) in a single timeline in FCP. I'm experiencing quality and rendering issues.  I've tried numerous settings but can't seem to figure this one out.  Thanks for your assistance.

    Although you can combine the avchd 1920x1080 material with prores 1920x1080 in the same timeline, you might land up saving time just converting everything to 1920x1080 prores 422.   You'd probably reduce the amount of rendering while you're working and exporting when you're done by a great deal.  This workflow will require much more drive space.

  • Need to add row and set attribute value on pageload

    Guys,
    On my page based on the pageflowscope variable value, i need to add a row for master and one row for detail viewobject and set attribute values. (Some of the attribute are LOV and Checkboxes as well)
    I am using following code to create records.....records are being added but i am not able to set the attributes
    OperationBinding ob;
    ob = ADFUtil.findOperationBinding("Create");
    ob.execute();
    ob = ADFUtil.findOperationBinding("CreateInsert3");
    ob.execute();
    I am using following code to set the attributes value
    DCIteratorBinding dc1 = ADFUtil.getBindingIterator("firstiterator");
    DCIteratorBinding dc = ADFUtil.getBindingIterator("seconditerator");
    row1=dc1.getCurrentRow();
    row=dc.getCurrentRow();
    row.setAttribute("activest","A");
    row1.setAttribute("type","dc14");
    Anything i am doing wrong here or any suggestion to try is greatly appreciated....

    Vinod,
    Yes commit button is there and yes its also has entry in pagedef...
    When I open the same page on edit mode and i can edit regular record and save them
    Problem is that when i open the page on new mode and try to add rows on page load..... and setting values as described above.... save button somehow doesn't work...
    seems like after i add the rows on the fly, i need to refresh the binding?
    any help is greatly appreciated....
    thank you guys

  • Update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow

    Hi,
    We have a requirement to update a column value once the item has been approved.
    Following settings have been made in the publishing articles list:
    Require content approval for submitted items : yes
    Create major and minor (draft) versions
    Who should see draft items in this document library? :Only users who can edit items
    Require documents to be checked out before they can be edited? : yes
    I have createdatu a Sharepoint 2013 workflow to check if Approval sts of current item = 0 i.e. Approved , then check out and update the item and finally checkin the item. Everything works fine till this point except that the minor version of the item is
    checked in. Due to this the updated columns are not published to others.
    Also, I created a Sharepoint 2010 workflow to SET CONTENT APPROVAL = APPROVED and started this workflow from my list workflow above, but the item does not get checked-in and always shows "In Progress" status with comment "The item is currently
    locked for editing. Waiting for item to be checked in or for the lock to be released.".
    Please let me know where I am missing out so that once the item is approved, column value gets updated and current item is still in Approved status.
    Thanks

    Hi,
    According to your post, my understanding is that you want to update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow.
    You will get into this kind of Catch-22 situation trying to set the Content Approval Status in SharePoint Designer workflow:
    - You must check out the document before you can change the Content Approval Status
             - You can't change the Content Approval Status once the document in checked out
    Since you set the Require documents to be checked out before they can be edited=Yes, you will need to check out the document when run the workflow on the item. But you cannot approve a document when it is checked
    out. So the logic in workflow conflicts.
    As a workaround, you can use the Start Another Workflow action to start the normal Approval workflow on the document.  The built-in Approval workflow can work with a document that’s not checked out.
    The designer approval workflow also can work with a document that’s not checked out.
    You can create two workflow using SharePoint Designer 2013.
    First, create a SharePoint 2010 platform workflow.
    Then, create a SharePoint 2013 platform workflow.
    Then when the SharePoint 2013 platform workflow start, it will start the SharePoint 2010 platform workflow to set content approval status, then the SharePoint 2013 platform workflow will update current item value.
    More information:
    SharePoint Designer Workflow Content Approval Issue
    SharePoint 2010 Approval Workflow with Content Approval
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How to get and set graph propertis using UIGraph instance

    Hi,
    I have added barGraph graph component on *.jspx and also added buttons like "Get properties" and "Set Properties". On "Get Properties" button action, I want to get all the attrributes of barGraph using UIGraph and also want to get "getGroupAttributes" and "getSeriesAttributes".
    I saw examples on gettiing the Group attributes using the click event on the graph.
    Is there any way to get the attributes on some button action like "Get Properties" without any click event on graph?
    Thanks,
    Gopal

    [Copying the answer here from the internal forum discussion so that other customers can benefit]
    Hi Gopal,
    You can call getValue on the UIGraph to get the GraphDataModel, then to use the data access APIs from there.
    Once you get the DataAccess from the GraphDataModel, you can call getMemberMetadata to get the members on the row and column edge.
    This method is documented in the interface CDFDataAccess:
    http://docs.oracle.com/cd/E16162_01/apirefs.1112/e17492/oracle/dss/util/CDFDataAccess.html#getMemberMetadata%28int,%20int,%20int,%20java.lang.String%29
    You should use the following constants for the series and groups:
    DataDirector.COLUMN_EDGE=groups
    DataDirector.ROW_EDGE=series
    Use the method getEdgeExtent to find out how many members are in the series and groups:
    http://docs.oracle.com/cd/E16162_01/apirefs.1112/e17492/oracle/dss/util/CDFDataAccess.html#getEdgeExtent%28int%29
    Method getLayerMetadata is the correct way to get the names of the layers, a.k.a "dimensions" displayed in the graph.
    DataAccess is used to read the data from the Graph. You set the data in the Graph by setting tabular data, using data binding by dragging and dropping from the data control palette, or by implementing a custom DataSource and setting it on the graph.
    http://docs.oracle.com/cd/E16162_01/apirefs.1112/e17492/oracle/dss/dataView/CommonDataview.html#setDataSource%28oracle.dss.util.DataSource%29
    However, implementing a custom data source is not trivial, and you should only use that approach if you can't use tabular data or regular binding against the available data controls.
    This doc chapter might help in understanding data source requirements for different Graph types:
    http://docs.oracle.com/cd/E16162_01/web.1112/e16181/dv_graph.htm#CEGBGCDG
    Hope this helps,
    Katia

  • Set Attribute using xmldom

    I have read in an xml document and provided the user with an interface to update information. I need to use this updated information to set attributes in an DOM Tree using the xmldom pl/sql package. How do I do this

    DBMS_XMLDOM.setAttribute does escape actually :
    SQL> declare
      2   doc dbms_xmldom.DOMDocument;
      3   e   dbms_xmldom.DOMElement;
      4   buf varchar2(4000);
      5  begin
      6   doc := dbms_xmldom.newDOMDocument('<dummy id1="" id2=""/>');
      7   e := dbms_xmldom.getDocumentElement(doc);
      8   dbms_xmldom.setAttribute(e, 'id1', 'R&D');
      9   dbms_xmldom.setAttribute(e, 'id2', 'X''Y');
    10   dbms_xmldom.writeToBuffer(doc, buf);
    11   dbms_xmldom.freeElement(e);
    12   dbms_xmldom.freeDocument(doc);
    13 
    14   dbms_output.put_line(buf);
    15  end;
    16  /
    <dummy id1="R&amp;D" id2="X&apos;Y"/>
    PL/SQL procedure successfully completed
    (tested on 11.2.0.2)
    What issue are you exactly having?
    Post something that we can reproduce on our end.

Maybe you are looking for